Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HinSAGE gives list index out of range as soon as I make the layer size a 2D array #2097

Open
akshatmalik opened this issue Sep 2, 2023 · 0 comments
Labels
bug Something isn't working sg-library

Comments

@akshatmalik
Copy link

Describe the bug

As soon as I make the layer sizes and num_samples a 2D array, the HinSage functions gives the following error

To Reproduce

Steps to reproduce the behavior:

  1. Go to '...'
  2. Execute '...'
  3. See error

Observed behavior

Traceback (most recent call last):
  File "/Users/maalik/PycharmProjects/GraphDefectPredictionML/main.py", line 171, in <module>
    activations=["relu", "relu"],
  File "/Users/maalik/opt/anaconda3/envs/GraphDefectPredictionML/lib/python3.6/site-packages/stellargraph/layer/hinsage.py", line 405, in __init__
    for layer, dim in enumerate([self.input_dims] + layer_sizes)
  File "/Users/maalik/opt/anaconda3/envs/GraphDefectPredictionML/lib/python3.6/site-packages/stellargraph/layer/hinsage.py", line 405, in <listcomp>
    for layer, dim in enumerate([self.input_dims] + layer_sizes)
IndexError: list index out of range

Expected behavior

Should not give an error, should make the model.

Environment

Operating system: for example: macOS, Ubuntu

Python version: for example: 3.7.2

Package versions: for example: stellargraph==0.8.3, tensorflow==2.0.0

The following Python code can automatically compute the data for this section (for example: run the code in a Jupyter notebook cell, or, on macOS, copy the code and run pbpaste | python - in a terminal):


    sgi = StellarGraph.from_networkx(nx_g, node_features="features", edge_weight_attr="features")

    print(sgi.info())

    train_nodes, test_nodes = model_selection.train_test_split(df, train_size=0.8, test_size=None, stratify=df["buggy"])
    all_labels = df["buggy"]
    train_labels = all_labels.loc[train_nodes.index]
    test_labels = all_labels.loc[test_nodes.index]

    generator = HinSAGENodeGenerator(sgi, batch_size=200, num_samples=[3, 4], head_node_type ="commit")
    train_gen = generator.flow(train_nodes.index, train_labels, shuffle=True)
    test_gen = generator.flow(test_nodes.index, test_labels)

    model = HinSAGE(
        layer_sizes=[10, 20],
        generator=generator,
        dropout=0.5,
        bias=True,
        normalize="l2",
        activations=["relu", "relu"],
    )

Additional context

Add any other context about the problem here. For example:

Data used:
StellarDiGraph: Directed multigraph
Nodes: 17146, Edges: 59737

Node types:
commit: [12450]
Features: float32 vector, length 4
Edge types: commit-default->person, commit-modified->file, commit-parent->commit
file: [4418]
Features: none
Edge types: none
person: [278]
Features: none
Edge types: none

Edge types:
commit-modified->file: [43419]
Weights: range=[0, 9070], mean=34.0921, std=139.13
Features: none
commit-parent->commit: [8159]
Weights: all 1 (default)
Features: none
commit-default->person: [8159]
Weights: all 1 (default)
Features: none

@akshatmalik akshatmalik added bug Something isn't working sg-library labels Sep 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working sg-library
Projects
None yet
Development

No branches or pull requests

1 participant