Skip to content

Instantly share code, notes, and snippets.

@stsievert
Last active November 1, 2018 04:58
Show Gist options
  • Save stsievert/0b8050ad5bb7c959d27f3f773793cdb9 to your computer and use it in GitHub Desktop.
Save stsievert/0b8050ad5bb7c959d27f3f773793cdb9 to your computer and use it in GitHub Desktop.
from dask_ml.model_selection import RandomizedSearchCV
from dask_ml.wrappers import Incremental
from dask_ml.datasets import make_classification
from sklearn.linear_model import SGDClassifier
import numpy as np
from sklearn.model_selection import KFold
X, y = make_classification(chunks=20)
params = {'estimator__alpha': np.logspace(-3, 0)}
search = RandomizedSearchCV(Incremental(SGDClassifier()), params, cv=KFold(5))
search.fit(X, y, classes=[0, 1])
print(search.best_score_)
print(search.best_params_)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment