简体   繁体   English

机器学习 - 分类问题

[英]Machine Learning - Classification Problem

是否有任何命令可以在预测模型中的任何值时调用错误分类的值,简而言之就是那些分类不准确的值。

There is no such method in the scikit-learn API. scikit-learn API 中没有这样的方法。 You can however write it yourself in a few lines:但是,您可以自己编写几行:

import numpy as np

X_train, X_test, y_train, y_test = ...  # some dataset
model = ...  # some scikit learn model
model.fit(X_train, y_train)
y_pred = model.predict(X_test)

# command to get misclassified examples assuming you have numpy arrays
X_test[np.argwhere(y_pred != y_test)]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM