MCPcopy Index your code
hub / github.com/amten/NeuralNetwork

github.com/amten/NeuralNetwork @v1.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.1 ↗ · + Follow
140 symbols 455 edges 11 files 29 documented · 21%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

What's this?

Java (convolutional or fully-connected) neural network implementation with plugin for [Weka] (http://www.cs.waikato.ac.nz/ml/weka/). Uses dropout and rectified linear units. Implementation is multithreaded and uses [MTJ] (https://github.com/fommil/matrix-toolkits-java) matrix library with native libs for performance.

Installation

Weka

Go to https://github.com/amten/NeuralNetwork/releases/latest to find the latest release. Download the files NeuralNetwork.zip and BLAS-dlls.zip. In Weka, go to Tools/Package Manager and press the "File/URL" button. Browse to the NeuralNetwork.zip file and press "ok".

Important! For optimal performance on Windows, you need to copy native matrix library dll-files to Wekas install dir. Unzip the BLAS-dlls.zip file to Wekas install dir (".../Program Files/Weka-3-7").

For Linux, native matrix library files have not been tested, though it should be possible to install using instructions given [here] (https://github.com/fommil/netlib-java#linux)

Standalone

This package was made mainly to be used from the Weka UI, but it can be used in your own java code as well.

Go to https://github.com/amten/NeuralNetwork/releases/latest to find the latest release. Download the file NeuralNetwork.zip and unzip.

Include the files NeuralNetwork.jar, lib/mtj-1.0-snapshot.jar, lib/opencsv-2.3.jar in your classpath.

Important! For optimal performance on Windows, you need to copy native matrix library dll-files to the directory where you execute your application, or any other directory in the PATH. Unzip the BLAS-dlls.zip to that directory.

For Linux, native matrix library files have not been tested, though it should be possible to install using instructions given [here] (https://github.com/fommil/netlib-java#linux)

Usage

Weka

In Weka, you will find the classifier under classifiers/functions/NeuralNetwork. For explanations of the settings, click the "more" button.

Note 1: If you start Weka with console (alternative available in the windows start menu), you will get printouts of cost during each iteration of training and you can press enter in the console window to halt the training.

Note 2: When using dropout as regularization, it might still be a good idea to keep a small weight penalty. This keeps weights from exploding and causing overflows.

Note 3: When using convolutional layers, it seems to be most efficient to use batch-size=1 (i.e. Stochastic Gradient Descent)

Standalone

Example code showing classification and regression can be found here: https://github.com/amten/NeuralNetwork/tree/master/src/amten/ml/examples

License

Free to copy and modify. Please include author name if you copy code.

Extension points exported contracts — how you extend this code

DataLoader (Interface)
Interface to be implemented by a class that loads training data from disk on-demand. Implement when training dataset is
src/amten/ml/DataLoader.java

Core symbols most depended-on inside this repo

numRows
called by 74
src/amten/ml/matrix/Matrix.java
get
called by 70
src/amten/ml/matrix/Matrix.java
numColumns
called by 61
src/amten/ml/matrix/Matrix.java
add
called by 48
src/amten/ml/matrix/Matrix.java
set
called by 36
src/amten/ml/matrix/Matrix.java
getData
called by 20
src/amten/ml/matrix/Matrix.java
getColumns
called by 18
src/amten/ml/matrix/Matrix.java
isConvolutional
called by 12
src/amten/ml/NNParams.java

Shape

Method 126
Class 13
Interface 1

Languages

Java100%

Modules by API surface

src/weka/classifiers/functions/NeuralNetwork.java38 symbols
src/amten/ml/matrix/Matrix.java28 symbols
src/amten/ml/NeuralNetwork.java21 symbols
src/amten/ml/matrix/MatrixUtils.java18 symbols
src/amten/ml/Convolutions.java10 symbols
src/amten/ml/matrix/MatrixElement.java6 symbols
src/amten/ml/NNParams.java6 symbols
src/amten/ml/examples/NNClassificationExample.java4 symbols
src/amten/ml/test/NeuralNetworkTest.java3 symbols
src/amten/ml/examples/NNRegressionExample.java3 symbols
src/amten/ml/DataLoader.java3 symbols

For agents

$ claude mcp add NeuralNetwork \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact