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

Graph Laplacian 🌐 #329

Merged
merged 13 commits into from
Oct 26, 2023
Merged

Graph Laplacian 🌐 #329

merged 13 commits into from
Oct 26, 2023

Conversation

KristinaUlicna
Copy link
Collaborator

@KristinaUlicna KristinaUlicna commented Oct 24, 2023

PR contribution summary

Why is this PR useful / good for? Please describe the problem(s) you're trying to address.
2 intertwined problems:

  1. No node features to train the classifier on: ▶️ feature_extractor.py
  • After re-consideration, compute the node features on the spot at runtime:
    • If config.extractor_fn is None, uses a simple image descriptor (mean, sum, max, min) of the underlaying patch to generate features. Super fast, preferable at the moment.
    • If config.extractor_fn is provided (must be called /path/to/resnetXX.pt), use it to extract image patch embeddings
    • E.g. ResNet18 uses as little as 6-8 seconds per image to compute the features, speeding up the processing.
  1. Neighbourhood-level representation for each node: ▶️ graph_laplacian.py
  • Learning performed on a vector twice as long as feature vector:
    • Appends another node feature representation to the graph to make node embeddings aware of their neighbourhood.
    • Calculates Laplacian of a graph, and multiplies the NODE_FEATURES matrix by the Laplacian matrix, generating NODE_EMBEDDINGS (see grace/base.py)
    • At dataset creation, both of these vectors are concatenated to create Data.x attribute (see datasets.py)

Note: No need to check the rest of the code.

List of proposed changes / linked issues & discussions

What should a reviewer concentrate their feedback on?

  • 🏃 Scripts / notebooks to run
    • run.py with config.extractor_fn as None
    • and/or config.extractor_fn called /path/to/resnet18.pt (or any resnet)
  • 💻 Code quality
  • No need to focus on the rest of the code.

What type of PR is this? (check all applicable)

  • 🪄 Feature
  • 🐛 Bug fix
  • 🧑‍💻 Code refactor / style
  • 🔥 Performance Improvements
  • ✅ Test (no need to check)

Added tests?

  • 🙋 no, because I need some help

@KristinaUlicna KristinaUlicna self-assigned this Oct 24, 2023
@KristinaUlicna KristinaUlicna added the methodology Building functional & diverse pipeline label Oct 24, 2023
@KristinaUlicna KristinaUlicna added this to the Merge `dev` -> `main` milestone Oct 24, 2023
@KristinaUlicna KristinaUlicna marked this pull request as draft October 24, 2023 16:55
@KristinaUlicna KristinaUlicna marked this pull request as ready for review October 24, 2023 20:21
@KristinaUlicna KristinaUlicna mentioned this pull request Oct 25, 2023
2 tasks
@marjanfamili marjanfamili self-requested a review October 26, 2023 14:59
Copy link
Collaborator

@marjanfamili marjanfamili left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KristinaUlicna explained all the changes to me. and I have inspected the code. Also ran this with the attached config file (from @KristinaUlicna ) both using the resent feature extractor and without which would be using the default.

The default extracts the mean and min and max and standard deviation

config_hyperparams.txt

(format has to be .yaml which can't be attached here)

@KristinaUlicna KristinaUlicna merged commit e9b5d66 into development Oct 26, 2023
1 check passed
@KristinaUlicna KristinaUlicna deleted the graph-laplacian branch October 26, 2023 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
methodology Building functional & diverse pipeline
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants