AnacletoLAB / grape

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

The Everything Bagel GCN failed #44

Closed mkarmona closed 5 months ago

mkarmona commented 1 year ago

I am following the tutorial to predict edges in an ensemble fashion. I computed three embeddings out of the graph

embedding_hyper_sketching = HyperSketching(number_of_hops=6).fit(g)
embedding_line_2 = SecondOrderLINEEnsmallen().fit_transform(g)
embedding_glee = GLEEEnsmallen().fit_transform(g)

I instantiate the object

model = GCNEdgePrediction(
    epochs=3, # 10 for production
    number_of_units_per_graph_convolution_layers = 32,
    number_of_units_per_ffnn_body_layer = 32,
    number_of_units_per_ffnn_head_layer = 16,
    kernels=["Symmetric Normalized Laplacian", "Transposed Symmetric Normalized Laplacian"],
    dropout_rate=0.7,
    use_edge_metrics=True,
    residual_convolutional_layers=False,
    use_node_embedding=True,
    edge_embedding_methods=["Concatenate", "Hadamard"],
    node_feature_names = ["GLEE", "LINE 2nd"],
    verbose=True
)

and when I compile it it complains

model.compile(
    graph=g,
    # The support graph is the graph whose topology is to be used for all things
    # including the convolutions, the metrics and the edge features.
    support=g,
    node_features=[embedding_glee, embedding_line_2],
    edge_features=[embedding_hyper_sketching]
)

with this message

AttributeError: 'EmbeddingResult' object has no attribute 'shape'

So then, when I fit it, the object throws this error

model.fit(
    graph=g,
    support=g,
    node_features=[embedding_glee, embedding_line_2],
    edge_features=[embedding_hyper_sketching]
)

NotImplementedError: Currently, we solely support edge features that are subclasses of AbstractEdgeFeature. This is because most commonly, it is not possible to precompute edge features for all possible edges of a complete graph and thus, we need to compute them on the fly. To do so, we need a common interface that allows us to query the edge features on demand, lazily, hence avoiding unsustainable memory peaks.You have provided an egde feature of type , which is not a subclass of AbstractEdgeFeature.

LucaCappelletti94 commented 1 year ago

Hi @mkarmona, the short of it is that in the version currently on Pypi some feature normalization steps are still missing. Since then, I have fixed them but I have yet to complete the testing of the updated features. It should be ready within the end of the week at the latest.

LucaCappelletti94 commented 1 year ago

Published new version, run pip install embiggen ensmallen -U and let me know whether it runs smoothly please.

mkarmona commented 9 months ago

@LucaCappelletti94 , this issue seems to be resolved. Please feel free to close this issue.