Skip to content

MNIST classification example seems to be broken #12504

Closed

Description

@jonas-schulze

Description

I cannot reproduce the MNIST classfification using multinomial logistic + L1 example.

Steps/Code to Reproduce

I copied the whole code, as is, into a Jupyter Notebook.

Expected Results

No errors and similar results to the example's web page.

Actual Results

Automatically created module for IPython interactive environment
---------------------------------------------------------------------------
JSONDecodeError                           Traceback (most recent call last)
<ipython-input-5-e53e77eeb3b2> in <module>
     19 
     20 # Load data from https://www.openml.org/d/554
---> 21 X, y = fetch_openml('mnist_784', version=1, return_X_y=True)
     22 
     23 random_state = check_random_state(0)

/opt/tljh/user/lib/python3.6/site-packages/sklearn/datasets/openml.py in fetch_openml(name, version, data_id, data_home, target_column, cache, return_X_y)
    478             "data_id.")
    479 
--> 480     data_description = _get_data_description_by_id(data_id, data_home)
    481     if data_description['status'] != "active":
    482         warn("Version {} of dataset {} is inactive, meaning that issues have "

/opt/tljh/user/lib/python3.6/site-packages/sklearn/datasets/openml.py in _get_data_description_by_id(data_id, data_home)
    293     error_message = "Dataset with data_id {} not found.".format(data_id)
    294     json_data = _get_json_content_from_openml_api(url, error_message, True,
--> 295                                                   data_home)
    296     return json_data['data_set_description']
    297 

/opt/tljh/user/lib/python3.6/site-packages/sklearn/datasets/openml.py in _get_json_content_from_openml_api(url, error_message, raise_if_error, data_home)
    131         else:
    132             return None
--> 133     json_data = json.loads(response.read().decode("utf-8"))
    134     response.close()
    135     return json_data

/opt/tljh/user/lib/python3.6/json/__init__.py in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
    352             parse_int is None and parse_float is None and
    353             parse_constant is None and object_pairs_hook is None and not kw):
--> 354         return _default_decoder.decode(s)
    355     if cls is None:
    356         cls = JSONDecoder

/opt/tljh/user/lib/python3.6/json/decoder.py in decode(self, s, _w)
    337 
    338         """
--> 339         obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    340         end = _w(s, end).end()
    341         if end != len(s):

/opt/tljh/user/lib/python3.6/json/decoder.py in raw_decode(self, s, idx)
    355             obj, end = self.scan_once(s, idx)
    356         except StopIteration as err:
--> 357             raise JSONDecodeError("Expecting value", s, err.value) from None
    358         return obj, end

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Versions

System
------
    python: 3.6.5 |Anaconda, Inc.| (default, Apr 29 2018, 16:14:56)  [GCC 7.2.0]
executable: /opt/tljh/user/bin/python
   machine: Linux-4.15.0-38-generic-x86_64-with-debian-buster-sid

BLAS
----
    macros: 
  lib_dirs: 
cblas_libs: cblas

Python deps
-----------
       pip: 10.0.1
setuptools: 39.1.0
   sklearn: 0.20.0
     numpy: 1.15.3
     scipy: 1.1.0
    Cython: None
    pandas: None

as well as these warnings:

/opt/tljh/user/lib/python3.6/site-packages/numpy/distutils/system_info.py:625: UserWarning: 
    Atlas (http://math-atlas.sourceforge.net/) libraries not found.
    Directories to search for the libraries can be specified in the
    numpy/distutils/site.cfg file (section [atlas]) or by setting
    the ATLAS environment variable.
  self.calc_info()
/opt/tljh/user/lib/python3.6/site-packages/numpy/distutils/system_info.py:625: UserWarning: 
    Blas (http://www.netlib.org/blas/) libraries not found.
    Directories to search for the libraries can be specified in the
    numpy/distutils/site.cfg file (section [blas]) or by setting
    the BLAS environment variable.
  self.calc_info()
/opt/tljh/user/lib/python3.6/site-packages/numpy/distutils/system_info.py:625: UserWarning: 
    Blas (http://www.netlib.org/blas/) sources not found.
    Directories to search for the sources can be specified in the
    numpy/distutils/site.cfg file (section [blas_src]) or by setting
    the BLAS_SRC environment variable.
  self.calc_info()

Activity

  1. samwaterbury commented on Nov 4, 2018

    @samwaterbury
    Contributor

    The important code is:

    from sklearn.datasets import fetch_openml
    X, y = fetch_openml('mnist_784', version=1, return_X_y=True)
    

    I was able to reproduce the error on the current release of scikit-learn but not on the most recent development version in this repo. I know some work was done recently on fetch_openml so I believe the issue has been resolved. However, if someone else could confirm that would be great.

  2. irrhuh commented on Nov 5, 2018

    @irrhuh

    Just encountered the same error.

    Not sure how to resolve it too.

  3. rth commented on Nov 5, 2018

    @rth
    Member

    Thanks for the report, I can reproduce this with 0.20.0 and can confirm this is fixed on master.

    The current workaround is either to use the latest development version or wait for the 0.20.1 release which should happen soon.

  4. Bruno-Hanzen commented on Nov 11, 2018

    @Bruno-Hanzen

    I have just experienced the same issue (2018/11/11), although:

    • it worked fine yesterday
      -scikit-learn version is 0.20.0
      -I have not updated any module since "quite a time" (certainly not last week).

    Are there changes ongoing @ Openml?

  5. thomasjpfan commented on Nov 11, 2018

    @thomasjpfan
    Member

    When calling mnist = fetch_openml('mnist_784', cache=False) it will request https://openml.org/api/v1/json/data/554 for information. This call returns an HTML object and not a JSON object. This will lead to a JSONDecodeError as well.

  6. jnothman commented on Nov 12, 2018

    @jnothman
    Member
  7. rth commented on Nov 12, 2018

    @rth
    Member

    Reported upstream openml/OpenML#861

  8. rth commented on Nov 12, 2018

    @rth
    Member

    Thanks for investigating this @thomasjfox !

  9. rth commented on Nov 12, 2018

    @rth
    Member

    Though I think there may be two separate issues here,

    • multiple reports that earlier this was happening only on 0.20 not on master
    • it seems to be happening on master as well now (the same or very similar error message). I just tested on master it now happens also for other datasets e.g. iris, so it seems to be a general OpenML outage.
  10. joaquinvanschoren commented on Nov 12, 2018

    @joaquinvanschoren
    Contributor

    Sorry, this was caused by a bad configuration setting on the server. Fixed now.

  11. rth commented on Nov 12, 2018

    @rth
    Member

    Thanks for the quick response, can confirm it works on scikit-learn master now.

  12. thomasjpfan commented on Nov 12, 2018

    @thomasjpfan
    Member

    @rth PR #12526 should be able to address other issue.

  13. z-a-f commented on Feb 22, 2019

    @z-a-f

    Same error (with the same call) resurfaced. Version: 0.20.2

  14. janvanrijn commented on Feb 22, 2019

    @janvanrijn
    Contributor

    Seems to be the same issue as this

    openml/OpenML#932

  15. janvanrijn commented on Feb 22, 2019

    @janvanrijn
    Contributor

    I applied a hotfix.

  16. joaquinvanschoren commented on Feb 22, 2019

    @joaquinvanschoren
    Contributor

    Found the bug and fixed it.

  17. Simondharcourt commented on Jul 4, 2019

    @Simondharcourt

    The important code is:

    from sklearn.datasets import fetch_openml
    X, y = fetch_openml('mnist_784', version=1, return_X_y=True)
    

    I was able to reproduce the error on the current release of scikit-learn but not on the most recent development version in this repo. I know some work was done recently on fetch_openml so I believe the issue has been resolved. However, if someone else could confirm that would be great.

    Awesome it works !!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions