New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

noobjs

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

noobjs

Algorithm Toolsets for Javascript

latest
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

NoobJS

Build Status

NoobJS contains Javascript implementations of many algorithms.

Algorithms Roadmap

Machine Learning

RegressionClassifierCluster
✔ Linear Regression✔ KNN Classifierk-mean Clustering
KNN using kd-tree
KNN using ball-tree
Gaussian Naive Bayes Classifier

Math and Numbers

MatrixBigNumberPrime
✔ Matrix Multiplication (Brute Force)✔ Long Addition✔ Primity Test (Brute Force)
✔ Matrix Transpose✔ Long Subtraction✔ Sieve of Eranthoses
✔ Matrix Inverse (Gaussian Elimination)✔ Long MultiplicationPollard's rho algorithm
✔ Long Division

Data Structure

BasicGraph
✔ QueueDepth-First Search
✔ StackBreadth-First search
✔ Priority Queue (Binary Heap)Prim's algorithm
✔ Hash Priority Queue

Examples

Using Linear Regression

var { LinearRegression } = require('noobjs').ML;

var x = [ 
    [0.17], [2.47], [1.73], [4.43], [4.51], 
    [4.59], [1.24], [0.84], [0.09], [0.51], 
    [2.06], [2.89], [0.81], [4.39], [1.20] 
];

var y = [ 
    [100.0], [410.0], [250.0], [560.0], [440.0], 
    [510.0], [230.0], [170.0], [100.0], [140.0], 
    [250.0], [460.0], [160.0], [490.0], [210.0] 
];

var model = new LinearRegression();
model.fit(x, y);
console.log( model.predict( [ [4.0], [2.0], [1.5] ] ) );

Using Elementary Data Structures

var { PriorityQueue, Stack, Queue } = require('noobjs').Collections;

var p = new PriorityQueue();
p.push(7);
p.push(8);
p.push(6);

console.log(p.pop());  // 6
console.log(p.pop());  // 7
console.log(p.pop());  // 8

Using NoobJS to solve linear system of equations

var { LinearAlgebra } = noobjs.Numbers;

//  x + 2y -  z = 2
// 2x + 2y + 2z = 12
//  x -  y + 2z = 5
var a = [
  [ 1,  2,  -1],
  [ 2,  2,   2],
  [ 1, -1,   2]
];

var b = [ [2], [12], [5] ];

console.log(LinearAlgebra.mat_multiply(LinearAlgebra.mat_inverse(a), b));
// [ 1.00, 2.00, 3.00 ]

Keywords

algorithm

FAQs

Package last updated on 02 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts