A JSON HTTP server for configuring and using simple, concurrently-accessible neural networks.
Each neural network runs safely in it's own goroutine.
Heavily based on http://www.datadan.io/building-a-neural-net-from-scratch-in-go/
Note: the entire Full Example JSON below can be POST
ed in place of each of the payloads.
Note: I have a nanobox deployed DigitalOcean 1Gb server running at http://192.241.205.72:4343
feel free to mess around.
-
To create a neural network
POST
the payload below tohttp://localhost:4343/learners/create
:{ "name": "example", "learning_rate": 0.1, "input_neurons": 10, "hidden_neurons": 4, "output_neurons": 4, "num_epochs": 5000 }
-
To train the neural network
POST
the payload below tohttp://localhost:4343/learners/train
:{ "name": "example", "entries": [ { "inputs": [1.0, 0.0, 1.0, 1.0, 0.2, 1.0, 0.0, 1.0, 1.0, 0.2], "labels": [0.0, 1.0, 0.1, 1.0] }, { "inputs": [1.0, 0.0, 0.98, 1.0, 0.0, 0.98, 1.0, 0.0, 0.98, 0.3], "labels": [0.0, 1.0, 0.1, 1.0] }, { "inputs": [1.0, 0.0, 1.0, 1.0, 0.2, 1.0, 0.0, 1.0, 1.0, 0.2], "labels": [0.0, 1.0, 0.1, 1.0] }, { "inputs": [1.0, 0.0, 0.98, 1.0, 0.0, 0.98, 1.0, 0.0, 0.98, 0.3], "labels": [0.0, 1.0, 0.1, 1.0] }, { "inputs": [1.0, 0.0, 1.0, 1.0, 0.2, 1.0, 0.0, 1.0, 1.0, 0.2], "labels": [0.0, 1.0, 0.1, 1.0] }, { "inputs": [1.0, 0.0, 0.98, 1.0, 0.0, 0.98, 1.0, 0.0, 0.98, 0.3], "labels": [0.0, 1.0, 0.1, 1.0] } ], "test_split": 0.3 }
-
To predict inputs on a neural network
POST
the payload below tohttp://localhost:4343/learners/predict
:{ "name": "example", "inputs": [ [1.0, 0.0, 0.50, 1.0, 0.0, 0.98, 1.0, 0.0, 0.98, 0.3] ] }
-
To delete a neural network
POST
the payload below tohttp://localhost:4343/learners/delete
:{ "name": "example" }
-
To reset a neural network
POST
the payload below tohttp://localhost:4343/learners/delete
:{ "name": "example" }
/learners/list
/learners/create
/learners/delete
/learners/reset
/learners/train
/learners/predict
{
"name": "example",
"entries": [
{
"inputs": [1.0, 0.0, 1.0, 1.0, 0.2, 1.0, 0.0, 1.0, 1.0, 0.2],
"labels": [0.0, 1.0, 0.1, 1.0]
},
{
"inputs": [1.0, 0.0, 0.98, 1.0, 0.0, 0.98, 1.0, 0.0, 0.98, 0.3],
"labels": [0.0, 1.0, 0.1, 1.0]
},
{
"inputs": [1.0, 0.0, 1.0, 1.0, 0.2, 1.0, 0.0, 1.0, 1.0, 0.2],
"labels": [0.0, 1.0, 0.1, 1.0]
},
{
"inputs": [1.0, 0.0, 0.98, 1.0, 0.0, 0.98, 1.0, 0.0, 0.98, 0.3],
"labels": [0.0, 1.0, 0.1, 1.0]
},
{
"inputs": [1.0, 0.0, 1.0, 1.0, 0.2, 1.0, 0.0, 1.0, 1.0, 0.2],
"labels": [0.0, 1.0, 0.1, 1.0]
},
{
"inputs": [1.0, 0.0, 0.98, 1.0, 0.0, 0.98, 1.0, 0.0, 0.98, 0.3],
"labels": [0.0, 1.0, 0.1, 1.0]
}
],
"inputs": [
[1.0, 0.0, 0.50, 1.0, 0.0, 0.98, 1.0, 0.0, 0.98, 0.3]
],
"learning_rate": 0.1,
"test_split": 0.3,
"input_neurons": 10,
"hidden_neurons": 4,
"output_neurons": 4,
"num_epochs": 5000
}