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

Documentation examples incorrect #357

Open
eahenle opened this issue May 11, 2023 · 1 comment
Open

Documentation examples incorrect #357

eahenle opened this issue May 11, 2023 · 1 comment

Comments

@eahenle
Copy link

eahenle commented May 11, 2023

In the documentation, code is given that does not run. The problem is that the node feature matrix is transposed vs. what it should be.

Example given:

fg = FeaturedGraph(erdos_renyi(100, 20))
fg = FeaturedGraph(fg, nf=rand(100, 5)) # DimensionMismatch

Correct code:

fg = FeaturedGraph(erdos_renyi(100, 20))
fg = FeaturedGraph(fg, nf=rand(5, 100))
@eahenle
Copy link
Author

eahenle commented May 12, 2023

Edit: this particular example actually seems like it's a rough edge between Flux and Pluto, and not actually an issue with GeometricFlux

Another example:

model = Chain(
    GCNConv(1024=>256, relu),
    x -> (node_feature(x), global_feature(x)),
    (nf, gf) -> (softmax(nf), identity.(gf))
) # this works

Implicit expectation:

model(some_featuredgraph) # ❌ this should work, but does not

Actual result: UndefVarError: node_feature not defined. This is very confusing, because node_feature(some_featuredgraph) works without issue in the same Pluto notebook.

Defining a function get_nf_gf solves this:

get_nf_gf(fg) = (node_feature(fg), global_feature(fg))

model = Chain(
    GCNConv(1024=>256, relu),
    get_nf_gf,
    (nf, gf) -> (softmax(nf), identity.(gf))
)

model(some_featuredgraph) # ✔️ 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant