4.0.8 • Published 6 years ago

nearest-neighbors v4.0.8

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

nearest-neighbors

flipactual Travis Codecov Node NPM

Find nearest neighbors & classify entities based on their neighbors

NearestNeighbors

Kind: global class

new NearestNeighbors()

constructor Initializes a machine for finding nearest neighbors.

nearestNeighbors.getNearestNeighbors(node, desiredNeighbors) ⇒ Array

Find the specified number of nearest neighbors for the provided node.

Kind: instance method of NearestNeighbors
Returns: Array - The nearest neighbors.

ParamTypeDescription
nodeObjectThe node to find neighbors for.
desiredNeighborsNumberThe number of neighbors to find.

nearestNeighbors.setDistancesFromNeighbors(node) ⇒ undefined

Assigns a distance from supplied node to each neighbor.

Kind: instance method of NearestNeighbors

ParamTypeDescription
nodeObjectThe node to find neighbors for.

nearestNeighbors.getDistancesFromNeighbor(node, neighbor) ⇒ Array

Find the range adjusted distances from supplied node to a neighbor for each feature.

Kind: instance method of NearestNeighbors
Returns: Array - The distances from this node to the neighbor in each dimension.

ParamTypeDescription
nodeObjectThe node to determine distances from.
neighborNodeThe neighbor to determine distances from.

nearestNeighbors.classify(node, desiredNeighbors, key) ⇒ String

Classify an entity based on its neighbors.

Kind: instance method of NearestNeighbors
Returns: String - The infered classification.

ParamTypeDescription
nodeObjectThe node to find neighbors for and classify.
desiredNeighborsNumberThe number of neighbors to find.
keyStringThe key to infer a value for.

Scripts

test – run the tests

npm run test

coverage – generate test coverage

npm run coverage

view-coverage – view test coverage

npm run view-coverage

lint – lint the codebase

npm run lint

write-readme – generate the README

npm run write-readme

License

MIT @ Flip

4.0.8

6 years ago

4.0.7

7 years ago

4.0.6

7 years ago

4.0.5

7 years ago

4.0.4

7 years ago

4.0.2

7 years ago

4.0.1

8 years ago

3.0.0

8 years ago

2.0.2

8 years ago

2.0.1

8 years ago

1.0.0

8 years ago