
Product
Socket Now Protects the Chrome Extension Ecosystem
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.
isolation-forest
Advanced tools
Isolation Forest for JavaScript / TypeScript.
Use it to efficiently detect anomalies in your dataset.
$ npm install --save isolation-forest
import { IsolationForest } from 'isolation-forest'
var isolationForest = new IsolationForest();
isolationForest.fit(trainingData) // Type ObjectArray ({}[]);
var trainingScores = isolationForest.scores()
// then predict any data
var scores = isolationForest.predict(data)
IsolationForest(numberOfTrees, subsamplingSize)
takes 2 optional paramaters.
numberOfTrees: Amount of trees the forest should generate. Default is 100, because for most datasets the anomaly scores converges with less than 100 trees.
subsamplingSize: Size of used subsamples of the dataset during trainging phase. Helps avoiding common problems in anomaly detection (swamping and masking). Default is 256 or the dataset size, if smaller.
For more info, see [1].
As stated in [1]:
If instances return a score very close to 1, then they are definitely anomalies.
If instances have a score much smaller than 0.5, then they are quite safe to be regarded as normal instances.
If all the instances return a score ≈ 0.5, then the entire sample does not really have any distinct anomaly.
Thank you for using my package. If you find bugs or have ideas to improve the package, open a PR on GitHub with your changes. I'll add the changes as soon as possible.
FAQs
Isolation Forest for anomaly detection.
We found that isolation-forest demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Product
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.
Product
Add secure dependency scanning to Claude Desktop with Socket MCP, a one-click extension that keeps your coding conversations safe from malicious packages.
Product
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.