JuliaML / MLDatasets.jl

Utility package for accessing common Machine Learning datasets in Julia
https://juliaml.github.io/MLDatasets.jl/stable
MIT License
229 stars 46 forks source link

Error when trying the Basic Usage instructions #225

Closed LeoWelter closed 7 months ago

LeoWelter commented 7 months ago

New to Julia I'm trying the following:

using MLDatasets
trainset = MNIST(:train)

instead of getting

dataset MNIST:
  metadata    =>    Dict{String, Any} with 3 entries
  split       =>    :train
  features    =>    28×28×60000 Array{Float32, 3}
  targets     =>    60000-element Vector{Int64}

I get

ERROR: MethodError: objects of type Module are not callable
Stacktrace:
 [1] top-level scope
   @ REPL[4]:1

The same for Iris. I'm using Julia 1.10.1 freshly installed. I downloaded the data with MNIST.download() What am I missing here?

ToucheSir commented 7 months ago

I just tried this in a fresh environment on 1.10.1 and it worked fine. Can you ensure you have the latest version of MLDatasets (v0.7.14) installed?

LeoWelter commented 7 months ago

I've tried a bit further. On a fresh install of Julia using curl -fsSL https://install.julialang.org | sh directly followed by Pkg.add("MLDatasets"), with no other packages installed I get the following:


julia> trainset = MNIST(:train)
This program has requested access to the data dependency MNIST.
which is not currently installed. It can be installed automatically, and you will not see this message again.

Dataset: THE MNIST DATABASE of handwritten digits
Authors: Yann LeCun, Corinna Cortes, Christopher J.C. Burges
Website: http://yann.lecun.com/exdb/mnist/

[LeCun et al., 1998a]
    Y. LeCun, L. Bottou, Y. Bengio, and P. Haffner.
    "Gradient-based learning applied to document recognition."
    Proceedings of the IEEE, 86(11):2278-2324, November 1998

The files are available for download at the offical
website linked above. Note that using the data
responsibly and respecting copyright remains your
responsibility. The authors of MNIST aren't really
explicit about any terms of use, so please read the
website to make sure you want to download the
dataset.

Do you want to download the dataset from ["https://ossci-datasets.s3.amazonaws.com/mnist/train-images-idx3-ubyte.gz", "https://ossci-datasets.s3.amazonaws.com/mnist/train-labels-idx1-ubyte.gz", "https://ossci-datasets.s3.amazonaws.com/mnist/t10k-images-idx3-ubyte.gz", "https://ossci-datasets.s3.amazonaws.com/mnist/t10k-labels-idx1-ubyte.gz"] to "/Users/victordejager/.julia/scratchspaces/124859b0-ceae-595e-8997-d05f6a7a8dfe/datadeps/MNIST"?
[y/n]
y
dataset MNIST:
  metadata  =>    Dict{String, Any} with 3 entries
  split     =>    :train
  features  =>    28×28×60000 Array{Float32, 3}
  targets   =>    60000-element Vector{Int64}

I never got this after installing MLDatasets in my 'old' installation (default 1.10, later upgraded to 1.10.1). Even running MNIST.download() did not resolve the error (even though it downloaded the data) So I guess it was a hiccup in my setup

ToucheSir commented 7 months ago

It's possible you had another package in the environment you were trying to install in which was holding this back. I'm going to call this one resolved, but feel free to reopen if you run into it again in a fresh environment.