Détail du package

ml-tree-similarity

mljs804.3kMIT2.2.0

Compares two spectra using a tree similarity

readme

tree-similarity

NPM version Test coverage npm download

Compares two spectra using a tree similarity.

Installation

$ npm i ml-tree-similarity

Usage

import { createTree, treeSimilarity } from 'ml-tree-similarity';

const a = {
  x: [1, 2, 3, 4, 5, 6, 7],
  y: [0.3, 0.7, 4, 0.3, 0.2, 5, 0.3],
};
const b = {
  x: [1, 2, 3, 4, 5, 6, 7],
  y: [0.3, 4, 0.7, 0.3, 5, 0.2, 0.3],
};

// create a tree
const options = { from: 1, to: 7 };
const aTree = createTree(a, options);
const bTree = createTree(b, options);

const ans = treeSimilarity(aTree, bTree, options);

API Documentation

This algorithm was based in the following papers:

License

MIT

changelog

Changelog

2.2.0 (2024-02-15)

Features

2.1.0 (2024-02-13)

Features

  • add compressTree to reduce tree size (c20c571)

Bug Fixes

2.0.0 (2024-02-08)

⚠ BREAKING CHANGES

  • treeSimilarity now only accepts Tree objects
  • createTree expects an object {x: [],y: []}

Code Refactoring

  • createTree expects an object {x: [],y: []} (ec9318f)
  • treeSimilarity now only accepts Tree objects (ec9318f)

Changelog

1.0.0 (2019-06-29)

chore

  • update dependencies and remove support for Node.js 6 (e8ad736)

BREAKING CHANGES

  • Node.js 6 is no longer supported.

0.1.0 (2017-08-10)

Bug Fixes

  • divide by number of children (eb7ce7e)

Performance Improvements

  • improve search on start (8edebc2)