npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

generics.js

v0.5.5

Published

A minimal library for Deep learning for the web

Downloads

5

Readme

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.

API Docs :

www.trygistify.com/generics

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