AnacletoLAB / grape

🍇 GRAPE is a Rust/Python Graph Representation Learning library for Predictions and Evaluations
MIT License
502 stars 38 forks source link

Grape edge prediction # edges reported #50

Open abbynewbury opened 12 months ago

abbynewbury commented 12 months ago

Hi!

I am using edge prediction evaluation and LogisticRegressionCVEdgePrediction for my graph, which has the following:

print(f"Number of edges in graph: {len(graph.get_edge_node_ids(directed=False))}") Number of edges in graph: 4541 print(f"Number of nodes in graph: {len(graph.get_node_ids())}") Number of nodes in graph: 1875.

However, when I run edge prediction evaluation: results = edge_prediction_evaluation( holdouts_kwargs=dict(train_size=0.8), graphs=graph, models=LogisticRegressionCVEdgePrediction(max_iter=500), number_of_holdouts=1, node_features=model ) where model = Node2VecSkipGramEnsmallen(embedding_size=EMBEDDING_SIZE,walk_length = WALK_LENGTH,return_weight = RETURN_WEIGHT, explore_weight=EXPLORE_WEIGHT, iterations=NUM_WALKS).fit_transform(graph)

I find that the results report: nodes_number: 1875 edges_number: 9082

I was wondering why the prediction is reporting double the number of edges than are actually present in the graph? Thanks!

LucaCappelletti94 commented 12 months ago

You are most likely predicting an undirected graph, which is a graph where interactions go in both directions. So it is providing the prediction in both directions.