Scikit-learn: How to obtain True Positive, True Negative, False Positive and False Negative

前端 未结 16 1282
一生所求
一生所求 2020-12-02 04:25

My problem:

I have a dataset which is a large JSON file. I read it and store it in the trainList variable.

Next, I pre-process

16条回答
  •  执念已碎
    2020-12-02 05:14

    #False positive cases
    train = pd.merge(X_train, y_train,left_index=True, right_index=True)
    y_train_pred = pd.DataFrame(y_train_pred)
    y_train_pred.rename(columns={0 :'Predicted'}, inplace=True )
    train = train.reset_index(drop=True).merge(y_train_pred.reset_index(drop=True),
    left_index=True,right_index=True)
    train['FP'] = np.where((train['Banknote']=="Forged") & (train['Predicted']=="Genuine"),1,0)
    train[train.FP != 0]
    

提交回复
热议问题