本页对应的英文页面已更新,但尚未翻译。 若要查看最新内容,请点击此处访问英文页面。

最近邻

使用 Kd 树搜索的 k 最近邻分类

要训练 k 最近邻模型,可以使用 Classification Learner App。为了获得更大的灵活性,可以在命令行界面中使用 fitcknn 训练 k 最近邻模型。训练模型后,可将模型和预测变量数据传递给 predict,以预测标签或估计后验概率。

App

Classification LearnerTrain models to classify data using supervised machine learning

函数

全部展开

fitcknnFit k-nearest neighbor classifier
ExhaustiveSearcherCreate exhaustive nearest neighbor searcher
KDTreeSearcherCreate Kd-tree nearest neighbor searcher
creatensCreate nearest neighbor searcher object
crossvalCross-validated k-nearest neighbor classifier
kfoldEdgeClassification edge for observations not used for training
kfoldLossClassification loss for observations not used for training
kfoldfunCross validate function
kfoldMarginClassification margins for observations not used for training
kfoldPredictPredict response for observations not used for training
lossLoss of k-nearest neighbor classifier
resubLossLoss of k-nearest neighbor classifier by resubstitution
compareHoldoutCompare accuracies of two classification models using new data
edgeEdge of k-nearest neighbor classifier
marginMargin of k-nearest neighbor classifier
resubEdgeEdge of k-nearest neighbor classifier by resubstitution
resubMarginMargin of k-nearest neighbor classifier by resubstitution
predictPredict labels using k-nearest neighbor classification model
resubPredictPredict resubstitution labels of k-nearest neighbor classifier
pdistPairwise distance between pairs of observations
pdist2Pairwise distance between two sets of observations

对象

全部展开

ClassificationKNNk-nearest neighbor classification
ClassificationPartitionedModelCross-validated classification model

主题

Train Nearest Neighbor Classifiers Using Classification Learner App

Create and compare nearest neighbor classifiers, and export trained models to make predictions for new data.

Visualize Decision Surfaces of Different Classifiers

This example shows how to visualize the decision surface for different classification algorithms.

Supervised Learning Workflow and Algorithms

Understand the steps for supervised learning and the characteristics of nonparametric classification and regression functions.

Classification Using Nearest Neighbors

Categorize data points based on their distance to points in a training data set, using a variety of distance metrics.

相关信息