Python 3.x 大熊猫的长期生存

Python 3.x 大熊猫的长期生存,python-3.x,pandas,amazon-web-services,Python 3.x,Pandas,Amazon Web Services,我在为手动混淆矩阵编写程序。我必须循环10公里以上的迭代 df_a=df_a.sort_values('proba') tpr_lst=[] fpr_lst=[] for i in tqdm(df_a['proba']): #df_a['proba'] contains 10K points, each point will be taken a new threshold to determine y_pred is 0 or 1, all this is too plot an ROC.

我在为手动混淆矩阵编写程序。我必须循环10公里以上的迭代

df_a=df_a.sort_values('proba')
tpr_lst=[]
fpr_lst=[]
for i in tqdm(df_a['proba']): #df_a['proba'] contains 10K points, each point will be taken a new threshold to determine y_pred is 0 or 1, all this is too plot an ROC.
    def y_pred_auc(x):
        if x<i:
            return 0
        else:
            return 1
    df_a['y_pred_auc']=df_a['proba'].map(y_pred_auc)
    df_a['con_mat_label_auc']=df_a[['y','y_pred']].apply(confusion_matrix,axis=1)
    tp_count=len(df_a['con_mat_label_auc']=='TP')
    fp_count=len(df_a['con_mat_label_auc']=='FP')
    tn_count=len(df_a['con_mat_label_auc']=='TN')
    fn_count=len(df_a['con_mat_label_auc']=='FN')

    tpr_auc=tp_count/(tp_count+fn_count)
    fpr_auc=fp_count/(tn_count+fp_count)

    tpr_lst.append(tpr_auc)
    fpr_lst.append(fpr_auc)
df_a=df_a.sort_值('proba'))
tpr_lst=[]
fpr_lst=[]
对于tqdm中的i(df_a['proba']):#df_a['proba']包含10K个点,每个点将采用一个新的阈值来确定y_pred为0或1,所有这一切都太过复杂。
定义y_pred_auc(x):

如果xSagemaker ml.p2.xlarge或使用p2.xlarge

使用后请停止实例,以避免过度支付