Skip to content

Instantly share code, notes, and snippets.

@im-noob
Last active October 16, 2021 08:02
Show Gist options
  • Save im-noob/ae2e0923b1e104486c67e971428ba1cc to your computer and use it in GitHub Desktop.
Save im-noob/ae2e0923b1e104486c67e971428ba1cc to your computer and use it in GitHub Desktop.
Grid Search CV
param_grid = {
'weights' : ['uniform', 'distance'],
'algorithm' : ['auto', 'ball_tree', 'kd_tree', 'brute'],
'leaf_size' : [30, 40, 50],
'n_neighbors' : [5, 10, 15],
}
gridSearchCV = GridSearchCV(KNeighborsRegressor(),param_grid=param_grid,n_jobs=-1)
-----------------------------------------------------------------------------------------------
param_grid = {
'fit_intercept' : [True, False],
'normalize' : [True, False],
'max_iter' : [1000, 2000],
'warm_start' : [True, False],
}
gridSearchCV = GridSearchCV(Lasso(),param_grid=param_grid,n_jobs=-1)
-----------------------------------------------------------------------------------------------
param_grid = {
'C': [0.001,0.01,0.1,1,10,100,1000],
'fit_intercept' : [True, False],
'solver' : ['newton-cg', 'lbfgs', 'liblinear'],
'max_iter': [100,200]
}
gridSearchCV = GridSearchCV(LogisticRegression(),param_grid=param_grid,n_jobs=-1)
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment