diff --git a/JGNN/src/examples/tutorial/Learning.java b/JGNN/src/examples/tutorial/Learning.java index 389e907..651961d 100644 --- a/JGNN/src/examples/tutorial/Learning.java +++ b/JGNN/src/examples/tutorial/Learning.java @@ -44,7 +44,7 @@ public static void main(String[] args) { .config("regularize", 1.E-5) .var("x") .operation("h = relu(x@matrix(features, 16, regularize)+vector(16))") - .operation("yhat = softmax(h@matrix(16, classes)+vector(classes), row)") + .operation("yhat = softmax(h@matrix(16, classes)+vector(classes), dim: 'row')") .out("yhat") .assertBackwardValidity(); diff --git a/JGNN/src/examples/tutorial/NN.java b/JGNN/src/examples/tutorial/NN.java index 1fac271..dbda563 100644 --- a/JGNN/src/examples/tutorial/NN.java +++ b/JGNN/src/examples/tutorial/NN.java @@ -36,7 +36,7 @@ public static void main(String[] args) { .layer("h{l+1} = relu(h{l}@matrix(features, hidden)+vector(hidden))") .layerRepeat("h{l+1} = relu(h{l}@matrix(hidden, hidden)+vector(hidden))", 2) .concat(2) - .layer("yhat = softmax(h{l}@matrix(2hidden, classes)+vector(classes), row)") + .layer("yhat = softmax(h{l}@matrix(2hidden, classes)+vector(classes), dim: 'row')") .out("yhat"); Slice sampleIds = dataset.samples().getSlice().shuffle(100); diff --git a/JGNN/src/examples/tutorial/Quickstart.java b/JGNN/src/examples/tutorial/Quickstart.java index 7a236b5..6f67ed9 100644 --- a/JGNN/src/examples/tutorial/Quickstart.java +++ b/JGNN/src/examples/tutorial/Quickstart.java @@ -1,8 +1,5 @@ package tutorial; -import java.nio.file.Files; -import java.nio.file.Paths; - import mklab.JGNN.adhoc.Dataset; import mklab.JGNN.adhoc.ModelBuilder; import mklab.JGNN.adhoc.datasets.Cora; @@ -42,8 +39,6 @@ public static void main(String[] args) throws Exception { .classify() .autosize(new EmptyTensor(numSamples)); - System.out.println(modelBuilder.getConfig("lr")); - ModelTraining trainer = new ModelTraining() .setOptimizer(new Adam(0.01)) .setEpochs(3000) diff --git a/docs/index.html b/docs/index.html index e1e5d51..fa3b6ab 100644 --- a/docs/index.html +++ b/docs/index.html @@ -866,12 +866,12 @@
Neuralang scripts consist of functions that declare machine learning
- components and their interactions using a syntax inspired by the
+ components. These call each other and adopt a syntax inspired by the
Mojo
language. Use a Rust highlighter to cover all keywords, though.
Before explaining how to use the Neuralang
model builder,
- To get a sense of the language's syntax, we present and analyse code that leads to a full
- architecture definition. First, look at the classify
+ we present and analyse code that supports a fully functional architecture.
+ First, look at the classify
function, which for completeness is presented below.
This takes two tensor inputs: nodes
that correspond to identifiers
insicating which nodes should be classified (the output has a number of rows equal to the
@@ -906,7 +906,8 @@
Next, let us look at the gcnlayer
function. This accepts
+
Next, let us look at some functions creating the main body of an architecture.
+ First, gcnlayer
accepts
two parameters: an adjacency matrix A
and input feature matrix h
.
The configuration hidden: 64
in the functions's signature
specifies the deafult number of hidden units,
@@ -935,7 +936,7 @@
We now move to parsing our declarations with the Neuralang
- model builder and using them to create an architecture. To this end, save your Neuralang code
+ model builder and using them to create an architecture. To this end, save your code
to a file and get is as a path Path architecture = Paths.get("filename.nn");
,
or avoid external files by inlining the definition within Java code through
a multiline String per String architecture = """ ... """;
.
@@ -944,15 +945,15 @@
For our model builder, we set remaining hyperparameters and overwrite the default value
- for "hidden"
using the
- .config(String, double)
method. Now that
- we know about broadcasts, this is the method that implements them. We also determine
- which variables are constants, namely the adjacency matrix A
and node
+
For the model builder, the following snippet sets remaining hyperparameters
+ and overwrites the default value
+ for "hidden"
. It also specifies
+ that certain variables are constants, namely the adjacency matrix A
and node
representation h
, as well as that node identifiers is a variable that serves
- as the architecture's inputs. There could be multiple inputs, so this distinction of what
+ as the architecture's inpu. There could be multiple inputs, so this distinction of what
is a constant and what is a variable depends mostly on which quantities change
- during training. In the case of node classification, both the adjacency matrix and
+ during training and is managed by onlt the Java-side of the code.
+ In the case of node classification, both the adjacency matrix and
node features remain constant, as we work in one graph. Finally, the definition
sets an Neuralang expression as the architecture's output
by calling the .out(String)
method,