Click or drag to resize
Accord.NET (logo)

KNearestNeighborsFromTree Method

Creates a new KNearestNeighbors algorithm from an existing KDTreeT. The tree must have been created using the input points and the point's class labels as the associated node information.

Namespace:  Accord.MachineLearning
Assembly:  Accord.MachineLearning (in Accord.MachineLearning.dll) Version: 3.8.0
Syntax
public static KNearestNeighbors FromTree(
	KDTree<int> tree,
	int k,
	int classes,
	double[][] inputs,
	int[] outputs
)
Request Example View Source

Parameters

tree
Type: Accord.CollectionsKDTreeInt32
The KDTreeT containing the input points and their integer labels.
k
Type: SystemInt32
The number of nearest neighbors to be used in the decision.
classes
Type: SystemInt32
The number of classes in the classification problem.
inputs
Type: SystemDouble
The input data points.
outputs
Type: SystemInt32
The associated labels for the input points.

Return Value

Type: KNearestNeighbors
A KNearestNeighbors algorithm initialized from the tree.
See Also