diff --git a/.travis.yml b/.travis.yml index c63fb9f5f..b73a3ea15 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,9 +15,11 @@ env: - TEST_DIR=/tmp/test_dir/ - MODULE=openml matrix: - - DISTRIB="conda" PYTHON_VERSION="2.7" NUMPY_VERSION="1.11" SCIPY_VERSION="0.17.0" CYTHON_VERSION="0.21" SKLEARN_VERSION="0.18" - - DISTRIB="conda" PYTHON_VERSION="3.4" NUMPY_VERSION="1.11" SCIPY_VERSION="0.17.0" CYTHON_VERSION="0.23.4" SKLEARN_VERSION="0.18" - - 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" + - DISTRIB="conda" PYTHON_VERSION="2.7" NUMPY_VERSION="1.11" SCIPY_VERSION="0.17.0" CYTHON_VERSION="0.21" SKLEARN_VERSION="0.18.1" + - 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" + - 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" + - 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" + install: source ci_scripts/install.sh script: bash ci_scripts/test.sh after_success: source ci_scripts/success.sh diff --git a/openml/flows/sklearn_converter.py b/openml/flows/sklearn_converter.py index 8e6187756..74c12a8cd 100644 --- a/openml/flows/sklearn_converter.py +++ b/openml/flows/sklearn_converter.py @@ -49,6 +49,9 @@ def sklearn_to_flow(o, parent_model=None): rval = o elif isinstance(o, dict): # TODO: explain what type of parameter is here + if not isinstance(o, OrderedDict): + o = OrderedDict([(key, value) for key, value in sorted(o.items())]) + rval = OrderedDict() for key, value in o.items(): if not isinstance(key, six.string_types): @@ -133,7 +136,7 @@ def flow_to_sklearn(o, **kwargs): else: rval = OrderedDict((flow_to_sklearn(key, **kwargs), flow_to_sklearn(value, **kwargs)) - for key, value in o.items()) + for key, value in sorted(o.items())) elif isinstance(o, (list, tuple)): rval = [flow_to_sklearn(element, **kwargs) for element in o] if isinstance(o, tuple): diff --git a/tests/test_flows/test_flow.py b/tests/test_flows/test_flow.py index 1b86dbbdf..b9496858c 100644 --- a/tests/test_flows/test_flow.py +++ b/tests/test_flows/test_flow.py @@ -209,7 +209,8 @@ def test_sklearn_to_upload_to_flow(self): y = iris.target # Test a more complicated flow - ohe = sklearn.preprocessing.OneHotEncoder(categorical_features=[1]) + ohe = sklearn.preprocessing.OneHotEncoder(categorical_features=[1], + handle_unknown='ignore') scaler = sklearn.preprocessing.StandardScaler(with_mean=False) pca = sklearn.decomposition.TruncatedSVD() fs = sklearn.feature_selection.SelectPercentile(