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

@tdjsnelling/isolation-forest

v0.0.8

Published

Isolation Forest for anomaly detection.

Downloads

2

Readme

Isolation Forest (JS / TS)

Isolation Forest for JavaScript / TypeScript.

Use it to efficiently detect anomalies in your dataset.

Install

$ npm install --save isolation-forest

Usage

import { IsolationForest } from 'isolation-forest'

var isolationForest = new IsolationForest();
isolationForest.fit(data) // Type ObjectArray ({}[]); 

var scores = isolationForest.scores()

Parameters

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].

Anomaly score

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.

Misc

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.

References

  1. Liu, F. T., Ting, K. M., & Zhou, Z. H. (2008, December). Isolation forest. In Data Mining, 2008. ICDM’08. Eighth IEEE International Conference on (pp. 413–422). IEEE.