Created
January 30, 2012 16:18
-
-
Save amueller/1705235 to your computer and use it in GitHub Desktop.
Scikit-learn rocks the cluster!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from IPython.parallel import Client | |
from sklearn.grid_search import GridSearchCV | |
from sklearn.cross_validation import KFold | |
from sklearn.svm import SVC | |
from sklearn import datasets | |
from sklearn.preprocessing import Scaler | |
from sklearn.utils import shuffle | |
digits = datasets.fetch_mldata("MNIST original") | |
X, y = digits.data, digits.target | |
X, y = shuffle(X, y) | |
X = Scaler().fit_transform(X) | |
params = dict(C=10. ** np.arange(-3, 3), gamma=10. ** np.arange(-3, 3)) | |
rc = Client(profile='sge') | |
view = rc.load_balanced_view() | |
grid = GridSearchCV(SVC(), param_grid=params, cv=KFold(len(y), 4), n_jobs=view) | |
grid.fit(X, y) | |
print(grid.grid_scores_) |
Just as @arnaudsj, I would find it very interesting to find out how to do that with the current version of scikit-learn.
Any news on this?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Which version of sklearn are you using? I tried running a similar example and got the following error: