[Python] Confusion matrix with cross validation

Discussão em 'Python' iniciado por Stack, Fevereiro 9, 2025.

  1. Stack

    Stack Membro Participativo

    I am training a svm classifier with cross validation (stratifiedKfold) using the scikits interfaces. For each test set (of k), I get a classification result. I want to have a confusion matrix with all the results.

    Scikit-learn has a confusion matrix interface:

    sklearn.metrics.confusion_matrix(y_true, y_pred)


    My question is how should I accumulate the y_true and y_pred values. They are arrays (numpy). Should I define the size of the arrays based on my k-fold parameter? And for each result I should add the y_true and y-pred to the array?

    Continue reading...

Compartilhe esta Página