Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

olearn

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

olearn

Collection of online classification algorithms. Online random forest.

  • 0.1.0
  • 0.1.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

Olearn

Olearn is a Node.js module implementing the online random forests algorithm, as specified by Saffari et al (2009), with some minor adaptations.

At some point, I hope to add more algorithms to this library.

Please note that the current version may be very buggy, so only use for experimentation.

Example usage

Initialise a forest

var OnlineForest = require("olearn").OnlineForest,
    of;

of = new OnlineForest({
  numTrees: 10,  // number of trees in the forest
  numTests: 20,  // number of random tests to create at each node
  maxDepth: 6,  // maximum depth of any node
  splitThreshold: 0.01,  // information gain threshold to split a node
  minSeen: 1000,  // min samples before splitting a node
  rangeTrialNum: 1000,  // number of samples to observe to determine feature range.,
  featureTypes: ["continuous", "continuous", "discrete"]  // either continous (numeric) or discrete
});

If the feature range is known in advance, set rangeTrialNum: 0 and specify ranges and rangeTypes:

ranges: [[-10, 10], [-10, 10], ["london", "glasgow", ...]],
rangeTypes: ["interval", "interval", "set"]

Update (train) the forest

of.update({
    features: [5, 2, "london"],
    label: "hot"
});
of.update({
    features: [-1, -5, "glasgow"],
    label: "cold"
});

(You'll need many more samples than this!)

Make a prediction

of.predict({
    features: [3, 5, "manchester"]
})

Example output:

{
    confidence: {"hot": 0.4, "cold": 0.6},
    label: "cold"
}

Keywords

FAQs

Package last updated on 13 Jul 2014

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc