SiRumCz / CSC501

CSC501 assignments
0 stars 1 forks source link

Matrix not working #82

Open soroushysfi opened 4 years ago

soroushysfi commented 4 years ago

I am having trouble getting the adjacency matrix working. I will leave it for now and start with the queries that we are trying to do. Can you guys give me some sample cypher queries that you've successfully run until now? And don't worry about transforming the data that much. If you think it is too much just send me the links and nodes I will convert them to the format I want.

soroushysfi commented 4 years ago

I am having trouble getting the adjacency matrix working. I will leave it for now and start with the queries that we are trying to do. Can you guys give me some sample cypher queries that you've successfully run until now? And don't worry about transforming the data that much. If you think it is too much just send me the links and nodes I will convert them to the format I want.

soroushysfi commented 4 years ago

I also talked to some other groups. They are mostly the same stage as we are (and having trouble running the cypher queries).

jonhealy1 commented 4 years ago

Most of the successful commands I have done are in examine_data.py. Others that I have done I don't remember. You can practice doing them on localhost:7474. There are some tutorials you can link to there. What were you trying to do for the matrix?

jonhealy1 commented 4 years ago

the .to_data.frame() command is handy. You can see that being used in examine_data.py to display tables.

soroushysfi commented 4 years ago

Most of the successful commands I have done are in examine_data.py. Others that I have done I don't remember. You can practice doing them on localhost:7474. There are some tutorials you can link to there. What were you trying to do for the matrix?

Yeah I'm working with the sandbox a bit and getting a sense but still bit confused. Matrix would be a good way to get more insights. As @SiRumCz said, if we show matrix with lots of nodes each edge in the matrix would be like a pixel in an image. So it would be good to extract some patterns from matrix visualization.

jonhealy1 commented 4 years ago
  1. We create some sort of new structure.
  2. We iterate through a dataframe taken from one of the csvs that I made on excel and have already uploaded.
  3. For each sourceid - targetid combination we store two values: total positive sentiment and total negative sentiment. We just keep adding sentiments up and those are our weights.
  4. We then construct our matrix.

What do you guys think?

soroushysfi commented 4 years ago
  1. We create some sort of new structure.
  2. We iterate through a dataframe taken from one of the csvs that I made on excel and have already uploaded.
  3. For each sourceid - targetid combination we store two values: total positive sentiment and total negative sentiment. We just keep adding sentiments up and those are our weights.
  4. We then construct our matrix.

What do you guys think?

I thought for every single edge that has a uniq source and target we only have one positive or negative sentiment, am I wrong? I was trying some queries and it seems like we don't have any relations defined between our nodes. So how are we suppose to query relations? because I tried so many times using Match and I couldn't get any results. A sample query I used was:

MATCH (s:Subreddit2{SourceSub:'leagueoflegends'})--(t:Subreddit2{TargetSub:'teamredditteams'})
RETURN t

I know that there is an edge in the data base with this source and target, but the query result was no records and it's because there is no relations defined between these nodes. I'm a bit confused right now. (s:...)--(t:..) means any type of relation regardless of direction.

jonhealy1 commented 4 years ago

@soroushysfi

  1. We only have one positive or negative for each relation say canada -> xbox. But there could be overall like 100 positive sentiments overall between canada -> xbox if you add them all up. When I draw the graph there's tons of connections between lots of pairs of nodes. We add up those connections to get weights. We can have a positive matrix and a negative one.

  2. We do this outside of neo4j with pandas in python or javascript if you think because neo4j is just too complicated to do this.

  3. I'm not sure about your query - I will try to figure it out.

soroushysfi commented 4 years ago

@soroushysfi

  1. We only have one positive or negative for each relation say canada -> xbox. But there could be overall like 100 positive sentiments overall between canada -> xbox if you add them all up. When I draw the graph there's tons of connections between lots of pairs of nodes. We add up those connections to get weights. We can have a positive matrix and a negative one.
  2. We do this outside of neo4j with pandas in python or javascript if you think because neo4j is just too complicated to do this.
  3. I'm not sure about your query - I will try to figure it out.

If that's the case yeah it would be cool to calculate the weights. Good idea!

jonhealy1 commented 4 years ago

Thanks. Like each negative or positive sentiment just associates one single post and there can be numerous posts between subreddits.

jonhealy1 commented 4 years ago

@soroushysfi A few things wrong with your query, try this:

MATCH (s:Subreddit{id:'leagueoflegends'})-[l:LINK]->(t:Subreddit{id:'teamredditteams'}) RETURN s, t

nodes should just be called 'Subreddit' (unless you're using the old database) and the names are id:

jonhealy1 commented 4 years ago

graph (2)

soroushysfi commented 4 years ago

@soroushysfi A few things wrong with your query, try this:

MATCH (s:Subreddit{id:'leagueoflegends'})-[l:LINK]->(t:Subreddit{id:'teamredditteams'}) RETURN s, t

nodes should just be called 'Subreddit' (unless you're using the old database) and the names are id:

Oh yeah I am using the old data base sorry. Thanks for mentioning it.