# ml-tree-similarity

> Compares two spectra using a tree similarity

Latest version **2.2.0** (published 2024-02-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install ml-tree-similarity
pnpm add ml-tree-similarity
yarn add ml-tree-similarity
bun add ml-tree-similarity
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.0 |
| Published | 2024-02-15 |
| First published | 2015-07-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 32.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Miguel Asencio |
| Maintainers | stropitek, targos, lpatiny, mljs-bot, maasencioh |

## Links

- npm: https://www.npmjs.com/package/ml-tree-similarity
- Repository: https://github.com/mljs/tree-similarity
- Homepage: https://github.com/mljs/tree-similarity#readme
- Issues: https://github.com/mljs/tree-similarity/issues
- npm.io page: https://npm.io/package/ml-tree-similarity

## Dependencies (2)

- [binary-search](https://npm.io/package/binary-search.md) ^1.3.6
- [cheminfo-types](https://npm.io/package/cheminfo-types.md) ^1.7.2

## Recent versions

- 2.2.0 (latest) — 2024-02-15
- 2.1.0 — 2024-02-13
- 2.0.0 — 2024-02-09
- 1.0.0 — 2019-06-29
- 0.1.0 — 2017-08-10
- 0.0.0 — 2015-07-15

## README

# tree-similarity

[![NPM version][npm-image]][npm-url]
[![Test coverage][codecov-image]][codecov-url]
[![npm download][download-image]][download-url]

Compares two spectra using a tree similarity.

## Installation

`$ npm i ml-tree-similarity`

## Usage

```js
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](https://mljs.github.io/tree-similarity/)

This algorithm was based in the following papers:

- [A new method for the comparison of 1H NMR predictors based on tree-similarity of spectra](https://doi.org/10.1186/1758-2946-6-9)
- [Fast and shift-insensitive similarity comparisons of NMR using a tree-representation of spectra](https://doi.org/10.1016/j.chemolab.2013.05.009)

## License

[MIT](./LICENSE)

[npm-image]: https://img.shields.io/npm/v/ml-tree-similarity.svg?style=flat-square
[npm-url]: https://npmjs.org/package/ml-tree-similarity
[codecov-image]: https://img.shields.io/codecov/c/github/mljs/tree-similarity.svg?style=flat-square
[codecov-url]: https://codecov.io/github/mljs/tree-similarity
[download-image]: https://img.shields.io/npm/dm/ml-tree-similarity.svg?style=flat-square
[download-url]: https://npmjs.org/package/ml-tree-similarity

---
_Source: https://npm.io/package/ml-tree-similarity · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
