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,12 +33,11 @@ class ClfSwitcher(BaseEstimator):
|
|||
parameters = [
|
||||
{
|
||||
'clf__estimator': [MLPClassifier(**rs
|
||||
, **njobs
|
||||
, max_iter = 500)],
|
||||
, 'clf__estimator__hidden_layer_sizes': [(1), (2), (3)]
|
||||
, 'clf__estimator__max_features': ['auto', 'sqrt']
|
||||
, 'clf__estimator__min_samples_leaf': [2, 4, 8]
|
||||
, 'clf__estimator__min_samples_split': [10, 20]
|
||||
, max_iter = 1000)]
|
||||
, 'clf__estimator__hidden_layer_sizes': [(1), (2), (3), (5), (10)]
|
||||
, 'clf__estimator__solver': ['lbfgs', 'sgd', 'adam']
|
||||
, 'clf__estimator__learning_rate': ['constant', 'invscaling', 'adaptive']
|
||||
#, 'clf__estimator__learning_rate': ['constant']
|
||||
|
||||
}
|
||||
]
|
||||
|
@ -68,7 +67,7 @@ gscv_mlp_fit_be_res = gscv_mlp_fit.cv_results_
|
|||
print('Best model:\n', gscv_mlp_fit_be_mod)
|
||||
print('Best models score:\n', gscv_mlp_fit.best_score_, ':' , round(gscv_mlp_fit.best_score_, 2))
|
||||
|
||||
print('\nMean test score from fit results:', round(mean(gscv_mlp_fit_be_re['mean_test_mcc']),2))
|
||||
print('\nMean test score from fit results:', round(mean(gscv_mlp_fit_be_res['mean_test_mcc']),2))
|
||||
print('\nMean test score from fit results:', round(np.nanmean(gscv_mlp_fit_be_res['mean_test_mcc']),2))
|
||||
|
||||
######################################
|
||||
|
@ -106,17 +105,15 @@ mlp_bts_dict['bts_jaccard'] = round(jaccard_score(y_bts, test_predict),2)
|
|||
mlp_bts_dict
|
||||
|
||||
# Create a df from dict with all scores
|
||||
pd.DataFrame.from_dict(mlp_bts_dict, orient = 'index', columns = 'best_model')
|
||||
|
||||
mlp_bts_df = pd.DataFrame.from_dict(mlp_bts_dict,orient = 'index')
|
||||
mlp_bts_df.columns = ['Logistic_Regression']
|
||||
mlp_bts_df.columns = ['MLP']
|
||||
print(mlp_bts_df)
|
||||
|
||||
# Create df with best model params
|
||||
model_params = pd.Series(['best_model_params', list(gscv_mlp_fit_be_mod.items() )])
|
||||
model_params_df = model_params.to_frame()
|
||||
model_params_df
|
||||
model_params_df.columns = ['Logistic_Regression']
|
||||
model_params_df.columns = ['MLP']
|
||||
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