0

I am using 10-fold cross-validation and evaluating the model on the basis of accuracy and precision. The confusion matrix is generated 10 times for each model. Can anyone please let me know how can I aggregate the confusion matrix and calculate the accuracy?

Thanks!!

2 Answers2

0

You can use cross_val_predict function as follows and use it result as confusion_matrix() argument.

from sklearn.metrics import confusion_matrix
from sklearn.model_selection import cross_val_predict

y_pred = cross_val_predict(clf, x, y, cv=5)
cm = confusion_matrix(y, y_pred)
0

You need to provide a bit more information about the format of the data you have!

If you're using tensorflow, you can refer this source