Skip to content

MNIST MemoryError #457

@i-taketoshi

Description

@i-taketoshi

i am getting the following error 03_classification.ipynb:
What am I missing?
Please help me.

try:
    from sklearn.datasets import fetch_openml
    mnist = fetch_openml('mnist_784', version=1, cache=True)
    mnist.target = mnist.target.astype(np.int8) # fetch_openml() returns targets as strings
    sort_by_target(mnist) # fetch_openml() returns an unsorted dataset
except ImportError:
    from sklearn.datasets import fetch_mldata
    mnist = fetch_mldata('MNIST original')
mnist["data"], mnist["target"]

Error message

---------------------------------------------------------------------------
MemoryError                               Traceback (most recent call last)
<ipython-input-2-3f28d0b20c3d> in <module>()
      1 try:
      2     from sklearn.datasets import fetch_openml
----> 3     mnist = fetch_openml('mnist_784', version=1, cache=True)
      4     mnist.target = mnist.target.astype(np.int8) # fetch_openml() returns targets as strings
      5     sort_by_target(mnist) # fetch_openml() returns an unsorted dataset

C:\Users\taketoshi\Anaconda3\lib\site-packages\sklearn\datasets\openml.py in fetch_openml(name, version, data_id, data_home, target_column, cache, return_X_y)
    641                           k in data_columns + target_column}
    642 
--> 643     X, y = _convert_arff_data(arff['data'], col_slice_x, col_slice_y, shape)
    644 
    645     is_classification = {col_name in nominal_attributes

C:\Users\taketoshi\Anaconda3\lib\site-packages\sklearn\datasets\openml.py in _convert_arff_data(arff_data, col_slice_x, col_slice_y, shape)
    246                            dtype='float64', count=count)
    247         data = data.reshape(*shape)
--> 248         X = data[:, col_slice_x]
    249         y = data[:, col_slice_y]
    250         return X, y

MemoryError: 

Setup Details

  • numpy 1.16.4
  • sklearn 0.21.2
  • windows10 32bit memory 4gb

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions