Loading dataset

It is used the “load_data()” function to load the dataset we’ll use for training. What I don’t understand is how can I load a dataset in my computer, for exemple, if it’s not specified the path.
Does the path goes inside the “()” of the function?

Thank you in advance for the help.

Hi @Alexandre_Leal !

The load_data() is a function designed for this course found in autils.py

This is what it looks like:

import numpy as np

def load_data():
    X = np.load("data/X.npy")
    y = np.load("data/y.npy")
    X = X[0:1000]
    y = y[0:1000]
    return X, y

Hope this helps!

Thank you, @SamReiswig.
But how can I load the data from a directory, a image folder, like in the “cat, not cat” exemple from the lecture?

For images I like to use the Pillow package. Image Module - Pillow (PIL Fork) 9.4.0 documentation
For tabular data I use Pandas. IO tools (text, CSV, HDF5, …) — pandas 1.5.2 documentation
For wav files I use a scipy package scipy.io.wavfile.read — SciPy v1.10.0 Manual

With each of these packages it’s as easy as passing the path to the method.

Thank you so much for the informations, @SamReiswig !

Where can I download the autils.py? Sometimes I want to run the code on my own computer, instead of the online iPython environment. But there are some libraries specifically for this course isn’t avaiable, such as:

from lr_utils import load_dataset
from public_tests import *

Is there a way to download the libraries lr-utils and public_tests for this course?

There is a topic about this on the DLS FAQ Thread.