简体   繁体   中英

Machine Learning - Classification Problem

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

There is no such method in the 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)]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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