saving work

This commit is contained in:
Tanushree Tunstall 2022-03-16 10:11:13 +00:00
parent a1631ea54b
commit e28a296d98
8 changed files with 153 additions and 212 deletions

View file

@ -82,13 +82,13 @@ def MultClassPipeSKF(input_df, y_targetF, var_type = ['numerical', 'categorical'
et = ExtraTreesClassifier(**rs)
rf = RandomForestClassifier(**rs)
rf2 = RandomForestClassifier(
min_samples_leaf = 50,
n_estimators = 150,
bootstrap = True,
oob_score = True,
n_jobs = -1,
random_state = 42,
max_features = 'auto')
min_samples_leaf = 50
, n_estimators = 150
, bootstrap = True
, oob_score = True
, n_jobs = -1
, **rs
, max_features = 'auto')
xgb = XGBClassifier(**rs, verbosity = 0)
classification_metrics = {
@ -97,20 +97,20 @@ def MultClassPipeSKF(input_df, y_targetF, var_type = ['numerical', 'categorical'
,'Precision': []
,'Recall': []
,'Accuracy': []
#,'ROC_AUC': []
,'ROC_AUC': []
}
models = [
('Logistic Regression' , log_reg)
, ('Naive Bayes' , nb)
, ('K-Nearest Neighbors', knn)
, ('SVM' , svm)
# , ('MLP' , mlp)
# , ('Decision Tree' , dt)
# , ('Extra Trees' , et)
# , ('Random Forest' , rf)
# , ('Naive Bayes' , nb)
, ('MLP' , mlp)
, ('Decision Tree' , dt)
, ('Extra Trees' , et)
, ('Random Forest' , rf)
, ('Naive Bayes' , nb)
#, ('Random Forest2' , rf2)
, ('Random Forest2' , rf2)
#, ('XGBoost' , xgb)
]
@ -118,7 +118,7 @@ def MultClassPipeSKF(input_df, y_targetF, var_type = ['numerical', 'categorical'
, shuffle = True
, **rs)
skf_dict = {}
# skf_dict = {}
fold_no = 1
fold_dict={}
@ -145,12 +145,12 @@ def MultClassPipeSKF(input_df, y_targetF, var_type = ['numerical', 'categorical'
#----------------
fscore = f1_score(y_test_fold, y_pred_fold)
mcc = matthews_corrcoef(y_test_fold, y_pred_fold)
#pres = precision_score(y_test_fold, y_pred_fold)
#recall = recall_score(y_test_fold, y_pred_fold)
pres = precision_score(y_test_fold, y_pred_fold, zero_division=0)
recall = recall_score(y_test_fold, y_pred_fold, zero_division=0)
pres = precision_score(y_test_fold, y_pred_fold)
recall = recall_score(y_test_fold, y_pred_fold)
#pres = precision_score(y_test_fold, y_pred_fold, zero_division=0)
#recall = recall_score(y_test_fold, y_pred_fold, zero_division=0)
accu = accuracy_score(y_test_fold, y_pred_fold)
#roc_auc = roc_auc_score(y_test_fold, y_pred_fold)
roc_auc = roc_auc_score(y_test_fold, y_pred_fold)
fold=("fold_"+str(fold_no))
@ -165,7 +165,7 @@ def MultClassPipeSKF(input_df, y_targetF, var_type = ['numerical', 'categorical'
fold_dict[model_name][fold].update({'Precision' : pres})
fold_dict[model_name][fold].update({'Recall' : recall})
fold_dict[model_name][fold].update({'Accuracy' : accu})
#fold_dict[model_name][fold].update({'ROC_AUC' : roc_auc})
fold_dict[model_name][fold].update({'ROC_AUC' : roc_auc})
fold_no +=1
#pp.pprint(skf_dict)