是否有一个 Python 函数来指定我想要用于 KNN 的权重?
我正在 Python 中使用 scikit-learn KNeighbors 回归器。我正在读一篇文章,其中他们定义 k 为 3,最近邻的权重为 50%,但另外两个的权重分别为 30% 和 20%。我一直在寻找有关如何使用可调用权重执行此类操作的文档,但我没有找到太多关于如何编写这样的可调用函数的信息。你有什么想法吗?
I am using the scikit-learn KNeighbors Regressor in Python. I was reading an article where they defined that k was 3 and the nearest neighbor was weighted 50% but the further two were weighted 30% and 20%, respectively. I have been looking all over for documentation on how to do something of the sort using callable weights but I am not finding much regarding how to write a callable function like this. Do you have any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
https://scikit-learn.org/stable/modules/生成/sklearn.neighbors.KNeighborsClassifier.html
https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.KNeighborsClassifier.html