ngboost icon indicating copy to clipboard operation
ngboost copied to clipboard

Add set_params for sklearn compatibility.

Open jckkvs opened this issue 2 years ago • 5 comments

Add set_params, get_params for sklearn compatibility. This change makes it easier to use with optimization libraries such as optuna or GridSearchCV. https://scikit-learn.org/stable/modules/generated/sklearn.base.BaseEstimator.html

Here is the pseudo code.

model = NGBoost(Base=default_tree_learner, Dist=Normal, natural_gradient=True, verbose=False)
def objective(trial):
    return something

study = optuna.create_study()
study.optimize(objective, n_trials=10)
model.set_params(study.best_params)

jckkvs avatar Feb 09 '22 01:02 jckkvs

@jckkvs It's still failing, I tried to push but I'd need permissions on the fork you have. You'll still need to run black for this to pass so, black ngboost/ngboost.py should do it.

ryan-wolbeck avatar Feb 18 '22 23:02 ryan-wolbeck

@ryan-wolbeck I applied black to ngboost.py

jckkvs avatar Feb 28 '22 05:02 jckkvs

@jckkvs can you pull/merge the current version of master into this PR? It should fix the f-string issue, @robertsont pushed a fix in that with the version bump https://github.com/stanfordmlgroup/ngboost/pull/286/files. So pulling master should make this PR pass

ryan-wolbeck avatar Mar 01 '22 15:03 ryan-wolbeck

bumping this @jckkvs, is this clear or do you need additional support?

ryan-wolbeck avatar Mar 23 '22 18:03 ryan-wolbeck

@jckkvs can you make the required updates here? I'll be closing this next week if it doesn't get resolved and pushing fixes on my own.

ryan-wolbeck avatar Sep 14 '22 15:09 ryan-wolbeck

implemented and released in another PR

ryan-wolbeck avatar Mar 30 '23 22:03 ryan-wolbeck