kNN doesn't work in quite the same way as other prediction methods such as regression. Predictions are made by searching the training data for the k nearest neighbours and averaging the response variable across those k neighbours. This searching and averaging happens each time you make a prediction. As such, there is no pre-trained model - the "model" is just the pre-labelled training dataset. Predicting using kNN therefore often takes more time and memory than other prediction methods, but you can apply the training data to any new data that you want to classify in the same way as you would for the test data.
发布评论
评论(1)
KNN的工作方式与其他预测方法(例如回归)的工作方式完全相同。通过搜索K最近的K邻居的训练数据来做出预测,并在这些K邻居中平均响应变量。每次进行预测时,这种搜索和平均都会发生。因此,没有预训练的模型 - “模型”只是预先标记的培训数据集。因此,使用KNN预测通常比其他预测方法需要更多的时间和内存,但是您可以将培训数据应用于您想要以与测试数据相同的方式进行分类的任何新数据。
kNN doesn't work in quite the same way as other prediction methods such as regression. Predictions are made by searching the training data for the k nearest neighbours and averaging the response variable across those k neighbours. This searching and averaging happens each time you make a prediction. As such, there is no pre-trained model - the "model" is just the pre-labelled training dataset. Predicting using kNN therefore often takes more time and memory than other prediction methods, but you can apply the training data to any new data that you want to classify in the same way as you would for the test data.