Advertisement
dredder_gun

network_visualzation_dz9

Nov 24th, 2022
740
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.97 KB | None | 0 0
  1. def measures_scores(embs, cats):
  2.     test_sizes = [0.99, 0.95, 0.9, 0.8, 0.7]
  3.     scores_results = []
  4.  
  5.     for test_size in test_sizes:
  6.       X_train, X_val, y_train, y_val = train_test_split(embs, cats, test_size=test_size)
  7.       gb_clf = GradientBoostingClassifier()
  8.       gb_clf.fit(X_train, y_train)
  9.       score = f1_score(y_val, gb_clf.predict(X_val), average='micro')
  10.       scores_results.append(score)
  11.  
  12.     return scores_results
  13.  
  14.  
  15. def embeddings_score_evaluate(_graph):
  16.     graph = _graph.copy()
  17.     laplacian_emb, svd_emb, deep_walk_emb, walklets_emb = xy_embeddings(graph)
  18.  
  19.     results = []
  20.     results.append(measures_scores(laplacian_emb, category_id))
  21.     results.append(measures_scores(svd_emb, category_id))
  22.     results.append(measures_scores(deep_walk_emb, category_id))
  23.     results.append(measures_scores(walklets_emb, category_id))
  24.  
  25.     return results
  26.  
  27. scores = embeddings_score_evaluate(gcc_cora)
  28.  
  29. def embeddings_score(gcc_cora):
  30.   return scores
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement