plotly - 用 KNN 绘图
问题描述
我正在knn
使用下一个代码对我的数据集进行分类:
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(accidentes[['col1', 'col2', 'col3']],accidentes['col4'], train_size=0.7, shuffle=False)
knn = KNeighborsClassifier(n_neighbors=3, algorithm='auto', metric='manhattan')
knn.fit(X_train, y_train)
X_test['predictions'] = knn.predict(X_test)
但我想在 python中绘制这个knn
分类器。plotly
我该怎么做?
解决方案
只需按照此https://plotly.com/python/knn-classification/示例处理您的数据即可。
推荐阅读
- sublimetext3 - Sublime 文本拆分视图,顶部 2 列,底部 1 列
- javascript - 未加载 HTTP 提供程序提供的图像
- javascript - jQuery / HTML - 应用字母过滤器时添加无结果消息
- r - R如何将具有多个空格的文本文件拆分为数据框
- google-cloud-firestore - 数据库 firestore 用户和组 (ManyToMany)
- c# - 用户只能赞一个帖子
- spring - 由于 java.net.ConnectException 无法找到 PropertySource:连接被拒绝
- java - 使用 PDFBox 正确地将 PDF 渲染为图像
- python - 有什么想法可以优化这个算法吗?
- php - 无法验证密码