A lightweight HTTP Koa server that uses Q, brain.js, and Redis as a datastore. Can be used as a good starting point for anyone interested in machine learning with Javascript.
- Install Node.js (at least 11.13)
- Install Redis
git pull https://github.com/acoyfellow/brain_server.git
npm install
dependencies,node --harmony server.js
to start- Add training data
HTTP GET
the root url for to classify{ r: 1, g: 0.4, b: 0 }
This is a simple starter point for writing an API that uses brain.js (which uses a neural network + backpropogation algo for training) to do some simple classification.
Here is some training data you can use (from brain.js docs):
{input: { r: 0.03, g: 0.7, b: 0.5 }, output: { black: 1 }}
{input: { r: 0.16, g: 0.09, b: 0.2 }, output: { white: 1 }}
{input: { r: 0.5, g: 0.5, b: 1.0 }, output: { white: 1 }}
HTTP POST
to the endpointhttp://{your_server}/insert
in x-www-form-urlencoded format with 4 inputsr
,g
,b
, andoutput
.r
,g
, andb
are numbersoutput
is boolean 0 or 1, where 0 is White and 1 is Black.