Skip to content

Add enrich_node_features_from to Dataset #146

@tizianocitro

Description

@tizianocitro

Is your feature request related to a problem? Please describe.

Yes. For transductive tasks I need to se the node features of val and test by taking them from the train ones.
The method should also check that all nodes in the incoming dataset appear in the features of the dataset that is providing the features.

Describe the solution you would like

I can do:

    train_dataset.enrich_node_features(
        enricher=LaplacianPositionalEncodingEnricher(num_features=32),
        enrichment_mode="replace",
    )
    val_dataset.hdata.x = train_dataset.hdata.x[: val_dataset.hdata.num_nodes]
    test_dataset.hdata.x = train_dataset.hdata.x[:, : test_dataset.hdata.num_nodes]

but want something like:

    train_dataset.enrich_node_features(
        enricher=LaplacianPositionalEncodingEnricher(num_features=32),
        enrichment_mode="replace",
    )
    val_dataset.enrich_node_features_from(dataset_with_features=train_dataset)
    val_dataset.enrich_node_features_from(dataset_with_features=train_dataset)

Describe alternatives you've considered

Add a node_features getter on Dataset and use like this:

    train_dataset.enrich_node_features(
        enricher=LaplacianPositionalEncodingEnricher(num_features=32),
        enrichment_mode="replace",
    )
    val_dataset.enrich_node_features_from(node_features=train_dataset.node_features)
    val_dataset.enrich_node_features_from(node_features=train_dataset.node_features)

Additional context

NA.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions