-3

I use this function to evaluate my model

def stratified_cv(X, y, clf_class, shuffle=True, n_folds=10, **kwargs):

     X = X.as_matrix().astype(np.float)
     y = y.as_matrix().astype(np.int)
     y_pred = y.copy()
     stratified_k_fold = cross_validation.StratifiedKFold(y, n_folds=n_folds, shuffle=shuffle)  
     y_pred = y.copy()
     for ii, jj in stratified_k_fold:
           X_train, X_test =  X[ii],  X[jj]
           y_train,y_test = y[ii],y[jj]
           clf = clf_class(**kwargs)
           clf.fit(X_train,y_train)
           y_pred[jj] = clf.predict(X_test)
      return y_pred  

And the confusion matrix is given for example

pass_agg_conf_matrix = metrics.confusion_matrix(y,       stratified_cv(X, y, linear_model.PassiveAggressiveClassifier))

enter image description here

Now I wanted to identify entries that are misclassified

Ibrahima Khalil
  • 121
  • 1
  • 12
  • 2
    Just use your predictor clf on every example x and find those for which y_pred is not equal to y. That shouldn't be that hard! – Zafi Sep 06 '16 at 09:45

1 Answers1

0

You can find out the misclassified predictions from the confusion matrix itself. The top right box gives the number of predictions predicted to be 0 but are not zero. And the lower left box shows those predicted 1but are not one. This above mentioned cells are known as true negative and false positive if the confusion matrix is built according to the correct convention.

Sayan Bose
  • 21
  • 1