Skip to content

Commit

Permalink
started organizing new tutorials
Browse files Browse the repository at this point in the history
  • Loading branch information
maniospas committed Aug 28, 2024
1 parent afb2110 commit eb92810
Show file tree
Hide file tree
Showing 390 changed files with 669 additions and 448 deletions.
Empty file added .mango.yaml
Empty file.
4 changes: 2 additions & 2 deletions JGNN/src/examples/graphClassification/SortPooling.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ public static void main(String[] args){
.setGraphLabels(dtrain.labels)
.setValidationSplit(0.2)
.setEpochs(300)
.setOptimizer(new Adam(0.001))
.setOptimizer(new Adam(0.01))
.setLoss(new CategoricalCrossEntropy())
.setNumBatches(10)
.setParallelizedStochasticGradientDescent(true)
.setValidationLoss(new VerboseLoss(new CategoricalCrossEntropy(), new Accuracy()));
.setValidationLoss(new VerboseLoss(new CategoricalCrossEntropy(), new Accuracy()).setPrintOnImprovement(true));

Model model = builder.getModel()
.init(new XavierNormal())
Expand Down
31 changes: 30 additions & 1 deletion JGNN/src/main/java/mklab/JGNN/nn/loss/report/VerboseLoss.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public class VerboseLoss extends Loss {
private PrintStream out;
private Tensor values;
private int batchCount = 0;
private boolean printOnImproveOnly = false;
private double bestLoss = Double.POSITIVE_INFINITY;

/**
* Instantiates a {@link VerboseLoss} given one or more comma-separated base
Expand All @@ -42,12 +44,29 @@ public VerboseLoss(Loss... baseLosses) {
* @param every The loss is reported on epochs 0, every, 2every, ... Default is
* 1.
* @return <code>this</code> verbose loss instance.
* @see #setPrintOnImprovement(boolean)
*/
public VerboseLoss setInterval(int every) {
this.every = every;
return this;
}

/**
* Changes by which criteria losses should be printed, that is, on every fixed
* count of epochs set by {@link #setInterval(int)} or whenever the primary loss
* (the first one enclosed in the constructor) decreases.
*
* @param printOnImproveOnly Whether losses should be printed only when the
* primary loss (which is used for trained parameter
* selection and early stopping) decreases. Default is
* false.
* @return <code>this</code> verbose loss instance.
*/
public VerboseLoss setPrintOnImprovement(boolean printOnImproveOnly) {
this.printOnImproveOnly = printOnImproveOnly;
return this;
}

/**
* Changes where the output is printed.
*
Expand All @@ -59,6 +78,9 @@ public VerboseLoss setStream(PrintStream out) {
return this;
}

/**
* Prints the current state of accumulated losses.
*/
public void print() {
String message = "Epoch " + epoch + " ";
for (int i = 0; i < baseLosses.length; i++)
Expand All @@ -69,7 +91,13 @@ public void print() {

@Override
public void onEndEpoch() {
if (epoch == 0 || epoch % every == 0)
double value = values.get(0);
if (value < bestLoss)
bestLoss = value;
if (printOnImproveOnly) {
if (value == bestLoss)
print();
} else if ((epoch == 0 || epoch % every == 0))
print();
values.setToZero();
batchCount = 0;
Expand All @@ -79,6 +107,7 @@ public void onEndEpoch() {
@Override
public void onEndTraining() {
epoch = 0;
bestLoss = Double.POSITIVE_INFINITY;
}

@Override
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ requests for features and clarifications are welcome.

## :dart: [Javadoc](https://mklab-iti.github.io/JGNN/javadoc/)

## :computer: [Tutorials](tutorials/README.md)

## :notebook: Citation

```
Expand Down
2 changes: 1 addition & 1 deletion docs/javadoc/Benchmarks.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Aug 27 02:22:30 EEST 2024 -->
<!-- Generated by javadoc (17) on Tue Aug 27 17:07:18 EEST 2024 -->
<title>Benchmarks</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Expand Down
2 changes: 1 addition & 1 deletion docs/javadoc/allclasses-index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Aug 27 02:22:30 EEST 2024 -->
<!-- Generated by javadoc (17) on Tue Aug 27 17:07:18 EEST 2024 -->
<title>All Classes and Interfaces</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Expand Down
2 changes: 1 addition & 1 deletion docs/javadoc/allpackages-index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Aug 27 02:22:30 EEST 2024 -->
<!-- Generated by javadoc (17) on Tue Aug 27 17:07:18 EEST 2024 -->
<title>All Packages</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Expand Down
2 changes: 1 addition & 1 deletion docs/javadoc/class-use/Benchmarks.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Aug 27 02:22:30 EEST 2024 -->
<!-- Generated by javadoc (17) on Tue Aug 27 17:07:18 EEST 2024 -->
<title>Uses of Class Benchmarks</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Expand Down
2 changes: 1 addition & 1 deletion docs/javadoc/classification/LogisticRegression.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Aug 27 02:22:30 EEST 2024 -->
<!-- Generated by javadoc (17) on Tue Aug 27 17:07:18 EEST 2024 -->
<title>LogisticRegression</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Expand Down
2 changes: 1 addition & 1 deletion docs/javadoc/classification/MLP.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Aug 27 02:22:30 EEST 2024 -->
<!-- Generated by javadoc (17) on Tue Aug 27 17:07:18 EEST 2024 -->
<title>MLP</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Aug 27 02:22:30 EEST 2024 -->
<!-- Generated by javadoc (17) on Tue Aug 27 17:07:18 EEST 2024 -->
<title>Uses of Class classification.LogisticRegression</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Expand Down
2 changes: 1 addition & 1 deletion docs/javadoc/classification/class-use/MLP.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Aug 27 02:22:30 EEST 2024 -->
<!-- Generated by javadoc (17) on Tue Aug 27 17:07:18 EEST 2024 -->
<title>Uses of Class classification.MLP</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Expand Down
2 changes: 1 addition & 1 deletion docs/javadoc/classification/package-summary.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Aug 27 02:22:30 EEST 2024 -->
<!-- Generated by javadoc (17) on Tue Aug 27 17:07:18 EEST 2024 -->
<title>classification</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Expand Down
2 changes: 1 addition & 1 deletion docs/javadoc/classification/package-tree.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Aug 27 02:22:30 EEST 2024 -->
<!-- Generated by javadoc (17) on Tue Aug 27 17:07:18 EEST 2024 -->
<title>classification Class Hierarchy</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Expand Down
2 changes: 1 addition & 1 deletion docs/javadoc/classification/package-use.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Aug 27 02:22:30 EEST 2024 -->
<!-- Generated by javadoc (17) on Tue Aug 27 17:07:18 EEST 2024 -->
<title>Uses of Package classification</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Expand Down
2 changes: 1 addition & 1 deletion docs/javadoc/deprecated-list.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Aug 27 02:22:30 EEST 2024 -->
<!-- Generated by javadoc (17) on Tue Aug 27 17:07:18 EEST 2024 -->
<title>Deprecated List</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Expand Down
2 changes: 1 addition & 1 deletion docs/javadoc/graphClassification/MeanPooling.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Aug 27 02:22:30 EEST 2024 -->
<!-- Generated by javadoc (17) on Tue Aug 27 17:07:18 EEST 2024 -->
<title>MeanPooling</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Expand Down
2 changes: 1 addition & 1 deletion docs/javadoc/graphClassification/MessageSortPooling.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Aug 27 02:22:30 EEST 2024 -->
<!-- Generated by javadoc (17) on Tue Aug 27 17:07:18 EEST 2024 -->
<title>MessageSortPooling</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Expand Down
2 changes: 1 addition & 1 deletion docs/javadoc/graphClassification/SortPooling.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Aug 27 02:22:30 EEST 2024 -->
<!-- Generated by javadoc (17) on Tue Aug 27 17:07:18 EEST 2024 -->
<title>SortPooling</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Expand Down
2 changes: 1 addition & 1 deletion docs/javadoc/graphClassification/SortPoolingManual.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Aug 27 02:22:30 EEST 2024 -->
<!-- Generated by javadoc (17) on Tue Aug 27 17:07:18 EEST 2024 -->
<title>SortPoolingManual</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Expand Down
2 changes: 1 addition & 1 deletion docs/javadoc/graphClassification/TrajectoryData.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Aug 27 02:22:30 EEST 2024 -->
<!-- Generated by javadoc (17) on Tue Aug 27 17:07:18 EEST 2024 -->
<title>TrajectoryData</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Aug 27 02:22:30 EEST 2024 -->
<!-- Generated by javadoc (17) on Tue Aug 27 17:07:18 EEST 2024 -->
<title>Uses of Class graphClassification.MeanPooling</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Aug 27 02:22:30 EEST 2024 -->
<!-- Generated by javadoc (17) on Tue Aug 27 17:07:18 EEST 2024 -->
<title>Uses of Class graphClassification.MessageSortPooling</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Aug 27 02:22:30 EEST 2024 -->
<!-- Generated by javadoc (17) on Tue Aug 27 17:07:18 EEST 2024 -->
<title>Uses of Class graphClassification.SortPooling</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Aug 27 02:22:30 EEST 2024 -->
<!-- Generated by javadoc (17) on Tue Aug 27 17:07:18 EEST 2024 -->
<title>Uses of Class graphClassification.SortPoolingManual</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Aug 27 02:22:30 EEST 2024 -->
<!-- Generated by javadoc (17) on Tue Aug 27 17:07:18 EEST 2024 -->
<title>Uses of Class graphClassification.TrajectoryData</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Expand Down
2 changes: 1 addition & 1 deletion docs/javadoc/graphClassification/package-summary.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Aug 27 02:22:30 EEST 2024 -->
<!-- Generated by javadoc (17) on Tue Aug 27 17:07:18 EEST 2024 -->
<title>graphClassification</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Expand Down
2 changes: 1 addition & 1 deletion docs/javadoc/graphClassification/package-tree.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Aug 27 02:22:30 EEST 2024 -->
<!-- Generated by javadoc (17) on Tue Aug 27 17:07:18 EEST 2024 -->
<title>graphClassification Class Hierarchy</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Expand Down
2 changes: 1 addition & 1 deletion docs/javadoc/graphClassification/package-use.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Aug 27 02:22:30 EEST 2024 -->
<!-- Generated by javadoc (17) on Tue Aug 27 17:07:18 EEST 2024 -->
<title>Uses of Package graphClassification</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Expand Down
2 changes: 1 addition & 1 deletion docs/javadoc/help-doc.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Aug 27 02:22:30 EEST 2024 -->
<!-- Generated by javadoc (17) on Tue Aug 27 17:07:18 EEST 2024 -->
<title>API Help</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Expand Down
2 changes: 1 addition & 1 deletion docs/javadoc/index-files/index-1.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Aug 27 02:22:30 EEST 2024 -->
<!-- Generated by javadoc (17) on Tue Aug 27 17:07:18 EEST 2024 -->
<title>A-Index</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Expand Down
2 changes: 1 addition & 1 deletion docs/javadoc/index-files/index-10.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Aug 27 02:22:30 EEST 2024 -->
<!-- Generated by javadoc (17) on Tue Aug 27 17:07:18 EEST 2024 -->
<title>K-Index</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Expand Down
4 changes: 3 additions & 1 deletion docs/javadoc/index-files/index-11.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Aug 27 02:22:30 EEST 2024 -->
<!-- Generated by javadoc (17) on Tue Aug 27 17:07:18 EEST 2024 -->
<title>L-Index</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Expand Down Expand Up @@ -129,6 +129,8 @@ <h2 class="title" id="I:L">L</h2>
<dd>&nbsp;</dd>
<dt><a href="../mklab/JGNN/adhoc/Dataset.html#loadGraph(java.lang.String)" class="member-name-link">loadGraph(String)</a> - Method in class mklab.JGNN.adhoc.<a href="../mklab/JGNN/adhoc/Dataset.html" title="class in mklab.JGNN.adhoc">Dataset</a></dt>
<dd>&nbsp;</dd>
<dt><a href="../mklab/JGNN/nn/NNOperation.ThreadData.html#lock()" class="member-name-link">lock()</a> - Method in class mklab.JGNN.nn.<a href="../mklab/JGNN/nn/NNOperation.ThreadData.html" title="class in mklab.JGNN.nn">NNOperation.ThreadData</a></dt>
<dd>&nbsp;</dd>
<dt><a href="../mklab/JGNN/core/tensor/DenseTensor.html#log()" class="member-name-link">log()</a> - Method in class mklab.JGNN.core.tensor.<a href="../mklab/JGNN/core/tensor/DenseTensor.html" title="class in mklab.JGNN.core.tensor">DenseTensor</a></dt>
<dd>&nbsp;</dd>
<dt><a href="../mklab/JGNN/core/Tensor.html#log()" class="member-name-link">log()</a> - Method in class mklab.JGNN.core.<a href="../mklab/JGNN/core/Tensor.html" title="class in mklab.JGNN.core">Tensor</a></dt>
Expand Down
2 changes: 1 addition & 1 deletion docs/javadoc/index-files/index-12.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Aug 27 02:22:30 EEST 2024 -->
<!-- Generated by javadoc (17) on Tue Aug 27 17:07:18 EEST 2024 -->
<title>M-Index</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Expand Down
2 changes: 1 addition & 1 deletion docs/javadoc/index-files/index-13.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Aug 27 02:22:30 EEST 2024 -->
<!-- Generated by javadoc (17) on Tue Aug 27 17:07:18 EEST 2024 -->
<title>N-Index</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Expand Down
2 changes: 1 addition & 1 deletion docs/javadoc/index-files/index-14.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) on Tue Aug 27 02:22:30 EEST 2024 -->
<!-- Generated by javadoc (17) on Tue Aug 27 17:07:18 EEST 2024 -->
<title>O-Index</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Expand Down
Loading

0 comments on commit eb92810

Please sign in to comment.