find the misclassified data in a confusion matrix
<p>I use this function to evaluate my model</p>

<pre><code>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  
</code></pre>

<p>And the confusion matrix is given for example</p>

<pre><code>pass_agg_conf_matrix = metrics.confusion_matrix(y,       stratified_cv(X, y, linear_model.PassiveAggressiveClassifier))
</code></pre>

<p><a href="http://i.stack.imgur.com/zC8ZI.png" rel="nofollow"><img src="http://i.stack.imgur.com/zC8ZI.png" alt="enter image description here"></a></p>

<p>Now I wanted to identify entries that are misclassified</p>

<p>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. </p>

python pandas machine-learning confusion-matrix