"NearestNeighbors" (Machine Learning Method)
- Method for Classify and Predict.
- Infers the class or value of a new example by analyzing its nearest neighbors in the feature space.
Details & Suboptions
- Nearest neighbors is a type of instance-based learning. In its simplest form, it picks the commonest class or averages the values among the k nearest neighbors.
- The following options can be given:
|"NeighborsNumber"||Automatic||the number of neighbors to consider (k)|
|"NearestMethod"||Automatic||the method to use for computing the k-nearest examples|
- Possible settings for "NearestMethod" include:
|"KDtree"||uses a k‐d tree data structure for storing the data|
|"Octree"||uses an octree data structure for storing the data|
|"Scan"||exaustive search on the entire dataset|
Basic Examples (2)
Train a classifier function on labeled examples:
Obtain information about the classifier:
Classify a new example:
Generate some data and visualize it:
Train a predictor function on it:
Compare the data with the predicted values and look at the standard deviation: