Skip to content

Commit

Permalink
new docs
Browse files Browse the repository at this point in the history
  • Loading branch information
maniospas committed Aug 17, 2024
1 parent c5a99aa commit fd0034d
Show file tree
Hide file tree
Showing 599 changed files with 1,417 additions and 118,073 deletions.
32 changes: 27 additions & 5 deletions JGNN/src/examples/nodeClassification/Scripting.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,37 @@ public static void main(String[] args) throws Exception {
Dataset dataset = new Cora();
dataset.graph().setMainDiagonal(1).setToSymmetricNormalization();

String architectures = """
fn classify(nodes, h, epochs: !3000, patience: !100, lr: !0.01) {
return softmax(h[nodes], dim: "row");
}
fn gcnlayer(A, h, hidden: 16, reg: 0.005) {
h = A@h@matrix(?, hidden, reg) + vector(hidden);
return h;
}
fn gcn(A, h, classes: extern) {
h = gcnlayer(A, h);
h = dropout(relu(h), 0.5);
h = gcnlayer(A, h, hidden: classes);
return h;
}
fn ngcn(A, h, nodes) {
h = classify(nodes, gcn(A,h));
return h;
}
""";

long numSamples = dataset.samples().getSlice().size();
long numClasses = dataset.labels().getCols();
ModelBuilder modelBuilder = new Neuralang()
.parse(Paths.get("../architectures.nn"))
.parse(architectures)
.constant("A", dataset.graph())
.constant("h", dataset.features())
.var("nodes")
.config("classes", dataset.labels().getCols())
.config("hidden", 16)
.out("classify(nodes, gcn(A,h))")
.autosize(new EmptyTensor(dataset.samples().getSlice().size()));
.config("classes", numClasses)
.config("hidden", numClasses+2)
.out("ngcn(A,h, nodes)")
.autosize(new EmptyTensor(numSamples));

ModelTraining trainer = new ModelTraining()
.configFrom(modelBuilder)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ A native Java library for graph neural networks.
## :dart: About

Graph Neural Networks (GNNs) are getting more and more popular, for example to
make predictions based on relational information, and to perform inference
make predictions based on relational information, or to perform inference
on small datasets. JGNN provides cross-platform implementations of this machine
learning paradigm that do not require dedicated hardware or firmware.

Expand Down
123 changes: 0 additions & 123 deletions docs/allclasses-frame.html

This file was deleted.

Loading

0 comments on commit fd0034d

Please sign in to comment.