layerganza
Version:
A feed-forward neural network with injectable layers, activation functions, and optimizers.
26 lines (25 loc) • 862 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const index_1 = require("./index");
//Create the model
let network = new index_1.Network([
new index_1.InputLayer(2),
new index_1.HiddenLayer(100, new index_1.LeakyRelu(), new index_1.AdamOptimizer()),
new index_1.OutputLayer(6, new index_1.Linear(), new index_1.AdamOptimizer())
]);
const trainingSets = []; //@TODO type
for (let i = 0; i < 10; i++) {
trainingSets.push([
(new Float64Array(100).map(() => Math.random())),
(new Float64Array(4).map(() => Math.random()))
]);
}
while (true) {
for (let i = 0; i < 3; i++) {
console.time('t');
index_1.shuffleTrain(network, trainingSets, 10000);
console.timeEnd('t');
}
}
//Get some output from the model
//console.log('Output for input [1,1]:', network.invoke([1, 1]));