Git Product home page Git Product logo

generics.js's Introduction

A minimal deep learning library for the web

generics.js

alt text

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.

Real time examples:

Food rating prediction: Google Colab

Dogs and cats prediction: Google Colab

Pull it using npm:

npm install generics.js --save

Manual installation:

git clone https://github.com/generic-matrix/generics.js.git
unzip generics.js.zip
cd generics.js && npm install -g --save

Use it as:

let gen = require("generics.js");

CPU Example:

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);

GPU Example:

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);

Features :

  1. K fold cross validation tests

(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);
  1. Easy retriving of model :

var model_dir = "my_model.json";
util.restore_model(model_dir).then(function(net2){
     console.log(net2);
});
  1. Inbuild CSV parsing :

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);
});

License :

https://github.com/generic-matrix/generics.js/blob/master/LICENSE

Logo icon for generics.js made by Good Ware from www.flaticon.com

generics.js's People

Contributors

generic-matrix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.