Created
June 4, 2022 04:16
-
-
Save Abhayparashar31/fd1b22af88b8695fa8dc6f63259e85ad to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Base Model | |
logrec = LogisticRegression() | |
## Parameter Grid | |
param_grid = [ | |
{'penalty' : ['l1', 'l2', 'elasticnet', 'none'], | |
'C' : np.logspace(-4, 4, 20), | |
'solver' : ['lbfgs','newton-cg','liblinear','sag','saga'], | |
'max_iter' : [100, 800,1000, 1200] | |
} | |
] | |
### Hyper parameter Tuning | |
from sklearn.model_selection import GridSearchCV | |
clf = GridSearchCV(logModel, param_grid = param_grid, cv = 3, verbose=True) | |
gsc = clf.fit(X,y) | |
print(gsc.best_estimator_) | |
---------------------------------------- | |
LogisticRegression(C=6.15848, class_weight=None, dual=False, | |
fit_intercept=True, intercept_scaling=1, l1_ratio=None, | |
max_iter=800, multi_class='auto', n_jobs=None, penalty='l2', | |
random_state=None, solver='newton-cg', tol=0.0001, verbose=0, | |
warm_start=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment