saving work

This commit is contained in:
Tanushree Tunstall 2022-06-21 18:12:31 +01:00
parent 7b378ca6f3
commit 137f19a285
5 changed files with 1289 additions and 1102 deletions

View file

@ -72,6 +72,8 @@ from sklearn.model_selection import GridSearchCV
from sklearn.base import BaseEstimator
from sklearn.impute import KNNImputer as KNN
import json
import argparse
import re
#%% GLOBALS
rs = {'random_state': 42}
@ -98,7 +100,7 @@ mcc_score_fn = {'mcc': make_scorer(matthews_corrcoef)}
jacc_score_fn = {'jcc': make_scorer(jaccard_score)}
#%%
# Multiple Classification - Model Pipeline
def MultModelsCl_dissected(input_df, target, skf_cv
def MultModelsCl(input_df, target, skf_cv
, blind_test_input_df
, blind_test_target
, add_cm = True # adds confusion matrix based on cross_val_predict
@ -299,6 +301,10 @@ def MultModelsCl_dissected(input_df, target, skf_cv
print('\nMCC on Blind test:' , bts_mcc_score)
print('\nAccuracy on Blind test:', round(accuracy_score(blind_test_target, bts_predict),2))
# Diff b/w train and bts test scores
# train_test_diff_MCC = cvtrain_mcc - bts_mcc_score
# print('\nDiff b/w train and blind test score (MCC):', train_test_diff)
mm_skf_scoresD[model_name]['bts_mcc'] = bts_mcc_score
mm_skf_scoresD[model_name]['bts_fscore'] = round(f1_score(blind_test_target, bts_predict),2)
mm_skf_scoresD[model_name]['bts_precision'] = round(precision_score(blind_test_target, bts_predict),2)