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

ml-tree-similarity

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ml-tree-similarity

Tree similarity in Javascript

  • 0.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
214K
decreased by-25.26%
Maintainers
1
Weekly downloads
 
Created
Source

tree-similarity

NPM version build status David deps npm download

Tree similarity in Javascript

Installation

npm install ml-tree-similarity

tree(a,b, from, to, [options])

Returns the tree similarity between two spectra in the format {'x':Array,'y':Array}

Options

  • alpha - weights the relative importance of intensity vs. shift match
  • beta - weights the relative importance of node matching and children matching
  • gamma - controls the attenuation of the effect of chemical shift differences
  • minWindow - smallest range to accept in x
  • threshold - smallest range to accept in y

Calc

Calculates the tree-similarity

CreateTree

Creates the tree based in the input dataset

Example

var tree = require('ml-tree-similarity');
var a = {
    'x': [1, 2, 3, 4, 5, 6, 7],
    'y': [0.3, 0.7, 4, 0.3, 0.2, 5, 0.3]
};
var b = {
    'x': [1, 2, 3, 4, 5, 6, 7],
    'y': [0.3, 4, 0.7, 0.3, 5, 0.2, 0.3]
};
// creates an actual tree
var A = tree.createTree(a.x, a.y, 1, 7).center.should.be.approximately(4.5,10e-4);
// a pre-calculated tree is also a valid input
var ans = tree.calc(A, b, 1, 7);
console.log(ans);

Test

$ npm install
$ npm test

Authors

License

MIT

Keywords

FAQs

Package last updated on 15 Jul 2015

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