Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

High-code grid search examples? #39

Open
jphall663 opened this issue May 31, 2023 · 2 comments
Open

High-code grid search examples? #39

jphall663 opened this issue May 31, 2023 · 2 comments

Comments

@jphall663
Copy link

Is it possible to make a high-code example for random or Cartesian grid search? I could not find one after a brief search of the doc ... please let me know if there is an example already.

Is there a preferred approach for grid search in PiML that I am missing?

@ZebinYang
Copy link
Collaborator

The PiML built-in models follow the sklearn style, and the sklearn's grid-search API can be used directly. For example, to tune the L1 and L2 regularization strengths, the following codes can be used:

from piml.models import GLMRegressor
from sklearn.model_selection import GridSearchCV

train_x, train_y, train_sample_weight = exp.get_data(train=True)

grid = GridSearchCV(GLMRegressor(), param_grid={"l1_regularzation": [0, 0.3],
                                                "l2_regularzation": [0, 0.3]})
grid.fit(train_x, train_y)

@jphall663
Copy link
Author

Ok - this is helpful. I'm going to leave open for a moment until I can make an example or some notes myself!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants