SelfExplainML/PiML-Toolbox

High-code grid search examples?

jphall663 opened this issue · 2 comments

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?

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)

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