Code Monkey home page Code Monkey logo

isolation-forest-js's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

isolation-forest-js's Issues

Subsample not used

for (let i = 0; i < this.numberOfTrees; i++) {
      const subsample = this.getSubsample(this.subsamplingSize);

      const iTree: ITree = new ITree(this.X, heightLimit);
      this.trees.push(iTree);
}

The subsample result is never used, so subsampling never happens

Usage example

Hi! Can you perhaps share an example of how to use this module?
I am curious to know what type of data it accepts for example

Import error "SyntaxError: Unexpected token {"

Thanks for building this package. I keep running into this error, so the pkg cannot work. Please help.

`import {IsolationForest} from 'isolation-forest';
^

SyntaxError: Unexpected token {
at Module._compile (internal/modules/cjs/loader.js:743:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:810:10)
at Module.load (internal/modules/cjs/loader.js:666:32)
at tryModuleLoad (internal/modules/cjs/loader.js:606:12)
at Function.Module._load (internal/modules/cjs/loader.js:598:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:862:12)
at `internal/main/run_main_module.js:21:11``

[Feature Request] Score new values from trained iForest

I'd like to request a feature be added so we can score a single new DataObject from an existing iForest. I believe this can be accomplished by adding a function similar to what's below. Please note I haven't tested this--just typed it out through this ticket and essentially just modified your scores function.

public score(x: DataObject): number {
  let pathLength: number = 0;
  for(let j = 0; j < this.numberOfTrees; j++) {
    pathLength += this.trees[j].pathLength(x, this.trees[j].getRootNode(), 0)
  }
  const meanPathLength = pathLength / this.numberOfTrees;
  const score = Math.pow(2, -(meanPathLength / averagePathLength(this.subsamplingSize)));
  return score;
}

The scores function could be refactored to call score if you'd like. If it's helpful I'd be happy to put a PR up.

Thanks for this library! Extremely helpful and easy to use.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.