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:
Tanushree Tunstall 2022-05-20 08:09:24 +01:00
parent 74af5ef890
commit 37bda41f44
18 changed files with 131 additions and 142 deletions

View file

@ -60,19 +60,19 @@ jacc_score_fn = {'jcc': make_scorer(jaccard_score)}
#%% Logistic Regression + hyperparam + FS: BaseEstimator: ClfSwitcher()
model_lr = LogisticRegression(**rs)
model_rfecv = RFECV(estimator = model_lr
, cv = skf_cv
, cv = rskf_cv
#, cv = 10
, scoring = 'matthews_corrcoef'
)
model_rfecv = SequentialFeatureSelector(estimator = model_lr
, n_features_to_select = 'auto'
, tol = None
# , cv = 10
, cv = skf_cv
# , direction ='backward'
, direction ='forward'
, **njobs)
# model_rfecv = SequentialFeatureSelector(estimator = model_lr
# , n_features_to_select = 'auto'
# , tol = None
# # , cv = 10
# , cv = rskf_cv
# # , direction ='backward'
# , direction ='forward'
# , **njobs)
# param_grid = [
# { 'C': np.logspace(0, 4, 10),
@ -296,4 +296,6 @@ print('\nFeatures selected from Sequential Feature Selector (Greedy):', len(sfsb
# Features selected from Sequential Feature Selector (Greedy, Forward): 6 [CV = 10]
#These are: Index(['duet_stability_change', 'deepddg', 'ddg_dynamut2', 'rsa', 'kd_values', 'maf']
###############################################################################
###############################################################################
# IMP: nice eg of including it as part of pipeline
# https://www.tomasbeuzen.com/post/scikit-learn-gridsearch-pipelines/