Skip to content

Commit 6fdba65

Browse files
authored
Merge pull request #240 from openml/develop
Develop into fix169 (II)
2 parents 280a515 + 65e8758 commit 6fdba65

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

.travis.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ env:
1515
- TEST_DIR=/tmp/test_dir/
1616
- MODULE=openml
1717
matrix:
18-
- DISTRIB="conda" PYTHON_VERSION="2.7" NUMPY_VERSION="1.11" SCIPY_VERSION="0.17.0" CYTHON_VERSION="0.21" SKLEARN_VERSION="0.18"
19-
- DISTRIB="conda" PYTHON_VERSION="3.4" NUMPY_VERSION="1.11" SCIPY_VERSION="0.17.0" CYTHON_VERSION="0.23.4" SKLEARN_VERSION="0.18"
20-
- DISTRIB="conda" PYTHON_VERSION="3.5" COVERAGE="true" NUMPY_VERSION="1.11" SCIPY_VERSION="0.17.0" CYTHON_VERSION="0.23.4" SKLEARN_VERSION="0.18"
18+
- DISTRIB="conda" PYTHON_VERSION="2.7" NUMPY_VERSION="1.11" SCIPY_VERSION="0.17.0" CYTHON_VERSION="0.21" SKLEARN_VERSION="0.18.1"
19+
- DISTRIB="conda" PYTHON_VERSION="3.4" NUMPY_VERSION="1.11" SCIPY_VERSION="0.17.0" CYTHON_VERSION="0.23.4" SKLEARN_VERSION="0.18.1"
20+
- DISTRIB="conda" PYTHON_VERSION="3.5" NUMPY_VERSION="1.11" SCIPY_VERSION="0.17.0" CYTHON_VERSION="0.23.4" SKLEARN_VERSION="0.18.1"
21+
- DISTRIB="conda" PYTHON_VERSION="3.6" COVERAGE="true" NUMPY_VERSION="1.12.1" SCIPY_VERSION="0.19.0" CYTHON_VERSION="0.25.2" SKLEARN_VERSION="0.18.1"
22+
2123
install: source ci_scripts/install.sh
2224
script: bash ci_scripts/test.sh
2325
after_success: source ci_scripts/success.sh

openml/flows/sklearn_converter.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ def sklearn_to_flow(o, parent_model=None):
4949
rval = o
5050
elif isinstance(o, dict):
5151
# TODO: explain what type of parameter is here
52+
if not isinstance(o, OrderedDict):
53+
o = OrderedDict([(key, value) for key, value in sorted(o.items())])
54+
5255
rval = OrderedDict()
5356
for key, value in o.items():
5457
if not isinstance(key, six.string_types):
@@ -133,7 +136,7 @@ def flow_to_sklearn(o, **kwargs):
133136
else:
134137
rval = OrderedDict((flow_to_sklearn(key, **kwargs),
135138
flow_to_sklearn(value, **kwargs))
136-
for key, value in o.items())
139+
for key, value in sorted(o.items()))
137140
elif isinstance(o, (list, tuple)):
138141
rval = [flow_to_sklearn(element, **kwargs) for element in o]
139142
if isinstance(o, tuple):

tests/test_flows/test_flow.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ def test_sklearn_to_upload_to_flow(self):
209209
y = iris.target
210210

211211
# Test a more complicated flow
212-
ohe = sklearn.preprocessing.OneHotEncoder(categorical_features=[1])
212+
ohe = sklearn.preprocessing.OneHotEncoder(categorical_features=[1],
213+
handle_unknown='ignore')
213214
scaler = sklearn.preprocessing.StandardScaler(with_mean=False)
214215
pca = sklearn.decomposition.TruncatedSVD()
215216
fs = sklearn.feature_selection.SelectPercentile(

0 commit comments

Comments
 (0)