def import_imdb_multi_graph(self): if os.path.exists(self.graph_path): multi_gnx = nx.read_gpickle(self.graph_path) else: from IMDb_data_preparation import main multi_gnx = main() nx.write_gpickle(multi_gnx, 'pkl/IMDb_multi_graph1.gpickle') return multi_gnx
def import_imdb_multi_graph(self): path = os.path.join(self.data_name, 'IMDb_multi_graph.gpickle') if os.path.exists(path): multi_gnx = nx.read_gpickle(path) else: from IMDb_data_preparation import main multi_gnx = main() nx.write_gpickle(multi_gnx, path) return multi_gnx
# dict_event2vec_embeddings = embedding_model.create_event2vec_embeddings() # nodes = list(dict_event2vec_embeddings.keys()) # relevant_edges = edges_to_predict(multi_graph) # true_edges = choose_true_edges(relevant_edges, number) # false_edges = choose_false_edges(multi_graph, relevant_edges, number) true_edges = choose_true_edges(graph, number) false_edges = choose_false_edges(graph, number, args.data_name, True) my_dict, X, Y = calculate_classifier_value(dict_embeddings, true_edges, false_edges, number) X_train, X_test, Y_train, Y_test = sk_ms.train_test_split( X, Y, test_size=ratio_arr[4]) prediction, probs = predict_edge_classification(X_train, X_test, Y_train, Y_test) micro, macro, acc, auc = evaluate_edge_classification(prediction, Y_test) print('acc: ', acc) print('auc: ', auc) print('micro: ', micro) print('macro: ', macro) # micro, macro, acc, auc = exp_lp(X, Y, ratio_arr, 3) # avg_micro, avg_macro, avg_acc, avg_auc = calculate_all_avg_scores(micro, macro, acc, auc, 3) # all_micro.append(avg_micro) # all_macro.append(avg_macro) # all_acc.append(avg_acc) # all_auc.append(avg_auc) # fig1, fig2, fig3, fig4 = split_vs_score(all_micro[0], all_macro[0], all_micro[1], all_macro[1], all_acc[0], # all_acc[1], all_auc[0], all_auc[1], ratio_arr) # plt.show() main()