Completed
Push — master ( 3e1d4c...f31f72 )
by Bart
27s
created

MNIST   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 27
Duplicated Lines 0 %
Metric Value
dl 0
loc 27
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __init__() 0 5 1
1
# -*- coding: utf-8 -*-
2
from fuel.datasets import H5PYDataset
3
from fuel.transformers.defaults import uint8_pixels_to_floatX
4
from fuel.utils import find_in_data_path
5
6
7
class MNIST(H5PYDataset):
8
    u"""MNIST dataset.
9
10
    MNIST (Mixed National Institute of Standards and Technology) [LBBH] is
11
    a database of handwritten digits. It is one of the most famous
12
    datasets in machine learning and consists of 60,000 training images
13
    and 10,000 testing images. The images are grayscale and 28 x 28 pixels
14
    large. It is accessible through Yann LeCun's website [LECUN].
15
16
    .. [LECUN] http://yann.lecun.com/exdb/mnist/
17
18
    Parameters
19
    ----------
20
    which_sets : tuple of str
21
        Which split to load. Valid values are 'train' and 'test',
22
        corresponding to the training set (60,000 examples) and the test
23
        set (10,000 examples).
24
25
    """
26
    filename = 'mnist.hdf5'
27
    default_transformers = uint8_pixels_to_floatX(('features',))
28
29
    def __init__(self, which_sets, **kwargs):
30
        kwargs.setdefault('load_in_memory', True)
31
        super(MNIST, self).__init__(
32
            file_or_path=find_in_data_path(self.filename),
33
            which_sets=which_sets, **kwargs)
34