Python Terminology of "pairs"
Question: I sort of learned backyard python without all of the fancy terminology, and I
came across this description of a pickled file...

"The pickled file represents a tuple of 3 lists : the training set, the
validation set and the testing set. **Each of the three lists is a pair formed
from a list of images and a list of class labels for each of the images.** An
image is represented as numpy 1-dimensional array of 784 (28 x 28) float
values between 0 and 1 (0 stands for black, 1 for white). The labels are
numbers between 0 and 9 indicating which digit the image represents."

(From <http://deeplearning.net/tutorial/gettingstarted.html>)

I'm trying to visualize it in my head (this is the format they want pickled so
I cant just modify it), does that mean that the file is

(1) Three Lists, Each of which is made up of two lists, one with images, and
one with labels,

(2) Three Lists, Each of which is composed of tuples, with (tuple[0] being
image and tuple[1] being label)

or something else?


Answer: Here's how you can investigate the topology of the data:

    
    
    In [1]: import cPickle
    In [2]:
    In [3]: f = cPickle.load(open('mnist.pkl', 'rb'))
    
    In [4]: type(f)
    Out[4]: tuple
    
    In [5]: len(f)
    Out[5]: 3
    
    In [6]: type(f[0])
    Out[6]: tuple
    
    In [7]: len(f[0])
    Out[7]: 2
    
    In [8]: type(f[0][0])
    Out[8]: numpy.ndarray
    
    In [9]: len(f[0][0])
    Out[9]: 50000
    
    In [10]: f[0][0].shape
    Out[10]: (50000, 784)
    

