The library allows to leverage to create and deploy real time deep learning solution currently including ANN and CNN with fully featured reinforcement learning and k-fold cross validation tests.
Food rating prediction: Google Colab
Dogs and cats prediction: Google Colab
npm install generics.js --save
git clone https://github.com/generic-matrix/generics.js.git
unzip generics.js.zip
cd generics.js && npm install -g --save
let gen = require("generics.js");
var x_axis=[[1,2,3,4],[6,7,8,9],[9,8,7,6],[5,4,3,2]];
var y_axis=[[1],[1],[0],[0]];
var util = new gen.Utilities();
var topology=[x_axis[0].length,y_axis[0].length];
var activations = [util.SIGMOID(),util.SIGMOID()];
var param={
"learning_rate":0.1
};
var net=new gen.Network(topology,activations,param);
util.train(net,x_axis,y_axis,1000);
util.save_model(net,"test.json");
var result=util.predict(net,[4,5,6,7]);
var result2=util.predict(net,[9,8,7,6]);
console.log("Expect 1 Given : "+result);
console.log("Expect 0 Given : "+result2);
Pull accelerator.js by :
npm install accelerator.js -g --save
let gen = require("generics.js");
var Accelerator=require("accelerator.js");
var settings=
{
"use_lib":"tf",
};
var util = new gen.Utilities(Accelerator,settings);
var x_axis=[[1,2,3,4],[6,7,8,9],[9,8,7,6],[5,4,3,2]];
var y_axis=[[1],[1],[0],[0]];
var topology=[x_axis[0].length,y_axis[0].length];
var activations = [util.SIGMOID(),util.SIGMOID()];
var param={
"learning_rate":0.1
};
var net=new gen.Network(topology,activations,param,Accelerator,settings);
util.train(net,x_axis,y_axis,1000);
util.save_model(net,"test.json");
var result=util.predict(net,[4,5,6,7]);
var result2=util.predict(net,[9,8,7,6]);
console.log("Expect 1 Given : "+result);
console.log("Expect 0 Given : "+result2);
(used to evaluate machine learning models on a limited data sample) :
var dir = "my_model.json";
var summary_url = "summary.json";
var training_count = 10;
var batch_size = 10;
var testing_threashold = 0.45;
var split_percent = 20;
var topology=[200,200,1];
var activations = [util.SIGMOID(),util.SIGMOID(),util.LEAKY_RELU()];
util.perform_k_fold(net, x_axis, y_axis, batch_size, training_count, dir, testing_threashold, split_percent);
var model_dir = "my_model.json";
util.restore_model(model_dir).then(function(net2){
console.log(net2);
});
Refer: https://www.trygistify.com/generics#preprocessingparse_csv
Example is from
Food rating prediction: Google Colab
var pre=new gen.Pre_Processing();
var fill_type = 0;
pre.parse_csv("/content/cereal.csv", fill_type, ["mfr", "type", "calories", "protein", "fat", "sodium", "fiber", "carbo", "sugars", "potass", "vitamins", "shelf", "weight", "cups"], ["rating"])
.then(function (json) {
console.log(json);
});
https://github.com/generic-matrix/generics.js/blob/master/LICENSE
Logo icon for generics.js made by Good Ware from www.flaticon.com