rlab
Version:
Javascript scientific library like R
43 lines (36 loc) • 843 B
JavaScript
/**
* Created by joonkukang on 2014. 1. 15..
*/
var R = require('../../rlab');
R.precision = 4;
var startTime = new Date();
var x = [[0.4, 0.5, 0.5, 0., 0., 0.],
[],
[],
[],
[],
[]];
var y = [[1, 0],
[],
[],
[],
[],
[]];
var mlp = new R.NN.MLP({
'input' : x,
'label' : y,
'nIns' : 6,
'nOuts' : 2,
'hiddenLayerSizes' : [4,4,5]
});
// mlp.set('log level',1);
mlp.train({
'lr' : 0.6,
'epochs' : 20000
});
a = [[0.5, 0.5, 0., 0., 0., 0.],
[],
[]];
console.log(mlp.predict(a));
var stopTime = new Date();
console.log('millseconds=', stopTime-startTime);