在 K-NN 中如何显示用于做出正确预测的 k 个案例集
In K-NN How to show the set of k cases that was used to make the correct prediction
我在 python 中使用 (k=10)
使用 K-NN 训练并测试了一个预测销售的模型。
knn = KNeighborsRegressor(n_neighbors=10, algorithm="brute")
knn.fit(X_train, y_train)
knn_pred = knn.predict(X_test)
test_data['predictied'] = knn_pred
我想显示由 K-NN 选择的 10 个案例集来对每一行进行预测。
我如何显示或检索 k
个案例?
kneighbors(self, X=None, n_neighbors=None, return_distance=True)
Finds the K-neighbors of a point. Returns indices of and distances to
the neighbors of each point.
此方法将return用于计算值的点的距离和索引
我在 python 中使用 (k=10)
使用 K-NN 训练并测试了一个预测销售的模型。
knn = KNeighborsRegressor(n_neighbors=10, algorithm="brute")
knn.fit(X_train, y_train)
knn_pred = knn.predict(X_test)
test_data['predictied'] = knn_pred
我想显示由 K-NN 选择的 10 个案例集来对每一行进行预测。
我如何显示或检索 k
个案例?
kneighbors(self, X=None, n_neighbors=None, return_distance=True)
Finds the K-neighbors of a point. Returns indices of and distances to the neighbors of each point.
此方法将return用于计算值的点的距离和索引