added and ran hyperparam script for all different classifiers, but couldn't successfully run the feature selection and hyperparam together
This commit is contained in:
parent
74af5ef890
commit
37bda41f44
18 changed files with 131 additions and 142 deletions
|
@ -33,10 +33,10 @@ class ClfSwitcher(BaseEstimator):
|
|||
parameters = [
|
||||
{
|
||||
'clf__estimator': [BernoulliNB()]
|
||||
, 'clf__estimator__alpha': [0, 1]
|
||||
, 'clf__estimator__binarize':['None', 0]
|
||||
, 'clf__estimator__alpha': [1, 0]
|
||||
, 'clf__estimator__binarize':[None, 0]
|
||||
, 'clf__estimator__fit_prior': [True]
|
||||
, 'clf__estimator__class_prior': ['None']
|
||||
, 'clf__estimator__class_prior': [None]
|
||||
}
|
||||
]
|
||||
|
||||
|
@ -65,7 +65,7 @@ gscv_bnb_fit_be_res = gscv_bnb_fit.cv_results_
|
|||
print('Best model:\n', gscv_bnb_fit_be_mod)
|
||||
print('Best models score:\n', gscv_bnb_fit.best_score_, ':' , round(gscv_bnb_fit.best_score_, 2))
|
||||
|
||||
print('\nMean test score from fit results:', round(mean(gscv_bnb_fit_be_re['mean_test_mcc']),2))
|
||||
print('\nMean test score from fit results:', round(mean(gscv_bnb_fit_be_res['mean_test_mcc']),2))
|
||||
print('\nMean test score from fit results:', round(np.nanmean(gscv_bnb_fit_be_res['mean_test_mcc']),2))
|
||||
|
||||
######################################
|
||||
|
@ -103,17 +103,15 @@ bnb_bts_dict['bts_jaccard'] = round(jaccard_score(y_bts, test_predict),2)
|
|||
bnb_bts_dict
|
||||
|
||||
# Create a df from dict with all scores
|
||||
pd.DataFrame.from_dict(bnb_bts_dict, orient = 'index', columns = 'best_model')
|
||||
|
||||
bnb_bts_df = pd.DataFrame.from_dict(bnb_bts_dict,orient = 'index')
|
||||
bnb_bts_df.columns = ['Logistic_Regression']
|
||||
bnb_bts_df.columns = ['BNB']
|
||||
print(bnb_bts_df)
|
||||
|
||||
# Create df with best model params
|
||||
model_params = pd.Series(['best_model_params', list(gscv_bnb_fit_be_mod.items() )])
|
||||
model_params_df = model_params.to_frame()
|
||||
model_params_df
|
||||
model_params_df.columns = ['Logistic_Regression']
|
||||
model_params_df.columns = ['BNB']
|
||||
model_params_df.columns
|
||||
|
||||
# Combine the df of scores and the best model params
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue