如何将已训练的KNN分类模型应用于新数据?

发布于 2025-01-27 13:32:43 字数 1398 浏览 2 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

七禾 2025-02-03 13:32:43

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文