Skip to content
This repository was archived by the owner on Dec 4, 2019. It is now read-only.

Commit 4e66b74

Browse files
committed
Set strict version requirement for scikit-learn 0.18.1
1 parent 3dc69d9 commit 4e66b74

File tree

4 files changed

+20
-10
lines changed

4 files changed

+20
-10
lines changed

python/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ More extensive documentation (generated with Sphinx) is available in the `python
6565
## Changelog
6666

6767
- 2015-12-10 First public release (0.1)
68-
- 2016-08-16 Minor release:
69-
1. the official Spark target is Spark 0.2
68+
- 2016-08-16 Minor release (0.2.0):
69+
1. the official Spark target is Spark 2.0
7070
2. support for keyed models
71+
- 2017-09-14 Minor release (0.2.2):
72+
1. The official Spark target is Spark >= 2.1
73+
7174

python/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"Programming Language :: Python",
2020
"Topic :: Scientific/Engineering",
2121
]
22-
INSTALL_REQUIRES = ["scikit-learn >= 0.18.1"]
22+
INSTALL_REQUIRES = ["scikit-learn == 0.18.1"]
2323

2424
# Project root
2525
ROOT = os.path.abspath(os.getcwd() + "/")

python/spark_sklearn/grid_search.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
Class for parallelizing GridSearchCV jobs in scikit-learn
33
"""
44

5-
import sys
6-
7-
from itertools import product
85
from collections import defaultdict, Sized
96
from functools import partial
107
import warnings
@@ -122,14 +119,14 @@ class GridSearchCV(BaseSearchCV):
122119
>>> clf = GridSearchCV(svr, parameters)
123120
>>> clf.fit(iris.data, iris.target)
124121
... # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
125-
GridSearchCV(cv=None, error_score=...,
122+
SPGridSearchWrapper(cv=None, error_score=...,
126123
estimator=SVC(C=1.0, cache_size=..., class_weight=..., coef0=...,
127-
decision_function_shape=None, degree=..., gamma=...,
124+
decision_function_shape=..., degree=..., gamma=...,
128125
kernel='rbf', max_iter=-1, probability=False,
129126
random_state=None, shrinking=True, tol=...,
130127
verbose=False),
131128
fit_params={}, iid=..., n_jobs=1,
132-
param_grid=..., pre_dispatch=..., refit=..., return_train_score=...,
129+
param_grid=..., pre_dispatch=..., refit=...,
133130
scoring=..., verbose=...)
134131
>>> sorted(clf.cv_results_.keys())
135132
... # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
@@ -242,9 +239,15 @@ def __init__(self, sc, estimator, param_grid, scoring=None, fit_params=None,
242239
n_jobs=1, iid=True, refit=True, cv=None, verbose=0,
243240
pre_dispatch='2*n_jobs', error_score='raise', return_train_score=True):
244241
super(GridSearchCV, self).__init__(
245-
estimator=estimator, scoring=scoring, fit_params=fit_params, n_jobs=n_jobs, iid=iid,
242+
estimator=estimator, scoring=scoring, n_jobs=n_jobs, iid=iid,
246243
refit=refit, cv=cv, verbose=verbose, pre_dispatch=pre_dispatch, error_score=error_score,
247244
return_train_score=return_train_score)
245+
246+
if fit_params is None:
247+
self.fit_params = {}
248+
else:
249+
self.fit_params = fit_params
250+
248251
self.sc = sc
249252
self.param_grid = param_grid
250253

python/spark_sklearn/tests/test_grid_search_1.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ def do_test_expected(*kwargs):
3232
return do_test_expected
3333

3434
def _add_to_module():
35+
# NOTE: This doesn't actually run scikit-learn tests against SPGridSearchWrapper
36+
# for scikit-learn >= 0.18, since the scikit-learn tests (in sklearn.model_selection.tests) use
37+
# sklearn.model_selection.GridSearchCV (not sklearn.grid_search.GridSearchCV)
38+
# TODO: Get scikit-learn tests to pass with spark-sklearn GridSearch implementation
3539
SKGridSearchCV = sklearn.grid_search.GridSearchCV
3640
sklearn.grid_search.GridSearchCV = SPGridSearchWrapper
3741
sklearn.grid_search.GridSearchCV_original = SKGridSearchCV

0 commit comments

Comments
 (0)