Flixster codes2/18/2023 ![]() # Delete edges with zero influence probabilities G.es = round(float(a_v2u) / user_action, 6) G.es = round(float(a_u2v) / user_action, 6)Įid_vu = g.get_eid(vid, uid, error= False) If u in user_action.keys() and v in user_action.keys():Įid_uv = g.get_eid(uid, vid, error= False) # Read edges, and replace the weights in g by influence probabilitiesį_edges = open( "learn/edgesCounts.txt", "r") G = Graph.Read_Ncol( "learn/graph_dir.txt", directed= True)į_nodes = open( "learn/usersCounts.txt", "r") # Read the directed graph (output of preprocess.py) BTW, I only keep the largest weakly connected component. The weights are the learned influence probabilities. Now, we try to get a weighted directed graph. TrainingActionsFile : learn/action_ids.txt # Config file for learning paramters (Scan 1) We convert file "edgesCounts.txt" to a file "inf_prob.txt" containing a set of directed edges with probabilities, using codes as follows.With open( "learn/action_ids.txt", "w") as fout_actionid: With open( "learn/action_logs.txt", "w") as fout_action:įout_action.write( "%d %d %d\n" % (line, line, line)) Print( "Number of action ids: ", len(movie_set))Īction_logs.sort(key = lambda t:(t,t,t)) Print( "Number of logs: ", len(action_logs)) Timestamp = int(datetime.strptime(arr, '%Y-%m-%d').strftime( "%s"))Īction_logs.append() Line = fin_rating.readline() # skip the first line ![]() G.write_ncol( "learn/graph_dir.txt", names= None)įin_rating = open( "raw/", "r") Print( "Number of directed edges: ", g.ecount()) # Output the directed graph (with weights) G.write_ncol( "learn/graph_undir.txt", names= None) # Output the undirected graph (with weights) Print( "Number of undirected edges: ", g.ecount()) G = Graph.Read_Edgelist( "raw/links.txt", directed= False) Clean the file: iconv -f utf-8 -t utf-8 -c >.Desired format: Each line contains an action id.Desired format: Each line contains “user_id action_id timestamp”.Sort action logs on action-ids and tuples on an action are chronologically ordered.Convert the date column (the last column) to a column of timestamps.Desired format: Each line contains “user_from user_to 0”.Download “The ratings in Flixster are associated with timestamps”.I put the dataset that I downloaded before in my Git repo.) If you know the new link, please let me know. Download here: (Update on June 6,2017: The link is no longer available.Now, we try to learn influence probabilities for some public datasets (with dirty codes). Static model: independent of time and simply to learnīernoulli distribution under the static model: $p_$.Solution to the error “‘getpid’ was not declared in this scope”: Add #includeīernoulli distribution under the static model:.“Make” (I am using Archlinux
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |