"NearestNeighbors" (Machine Learning Method)

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"Automaticthe number of neighbors to consider (k)
    "DistributionSmoothing"0.5regularization parameter
    "NearestMethod"Automaticthe method to use for computing the k-nearest examples
  • Possible settings for "NearestMethod" include:
  • "KDtree"uses a kd tree data structure for storing the data
    "Octree"uses an octree data structure for storing the data
    "Scan"exaustive search on the entire dataset

Examples

open all close all

Basic Examples  (2)

Train a classifier function on labeled examples:

In[1]:=
Click for copyable input
Out[1]=

Obtain information about the classifier:

In[2]:=
Click for copyable input
Out[2]=

Classify a new example:

In[3]:=
Click for copyable input
Out[3]=

Generate some data and visualize it:

In[1]:=
Click for copyable input
Out[1]=

Train a predictor function on it:

In[2]:=
Click for copyable input
Out[2]=

Compare the data with the predicted values and look at the standard deviation:

In[3]:=
Click for copyable input
Out[3]=

Options  (6)