text
stringlengths 0
1.46k
|
---|
Fashion MNIST dataset, an alternative to MNIST |
load_data function |
tf.keras.datasets.fashion_mnist.load_data() |
Loads the Fashion-MNIST dataset. |
This is a dataset of 60,000 28x28 grayscale images of 10 fashion categories, along with a test set of 10,000 images. This dataset can be used as a drop-in replacement for MNIST. |
The classes are: |
Label Description |
0 T-shirt/top |
1 Trouser |
2 Pullover |
3 Dress |
4 Coat |
5 Sandal |
6 Shirt |
7 Sneaker |
8 Bag |
9 Ankle boot |
Returns |
Tuple of NumPy arrays: (x_train, y_train), (x_test, y_test). |
x_train: uint8 NumPy array of grayscale image data with shapes (60000, 28, 28), containing the training data. |
y_train: uint8 NumPy array of labels (integers in range 0-9) with shape (60000,) for the training data. |
x_test: uint8 NumPy array of grayscale image data with shapes (10000, 28, 28), containing the test data. |
y_test: uint8 NumPy array of labels (integers in range 0-9) with shape (10000,) for the test data. |
Example |
(x_train, y_train), (x_test, y_test) = fashion_mnist.load_data() |
assert x_train.shape == (60000, 28, 28) |
assert x_test.shape == (10000, 28, 28) |
assert y_train.shape == (60000,) |
assert y_test.shape == (10000,) |
License: The copyright for Fashion-MNIST is held by Zalando SE. Fashion-MNIST is licensed under the MIT license. |
MNIST digits classification dataset |
load_data function |
tf.keras.datasets.mnist.load_data(path="mnist.npz") |
Loads the MNIST dataset. |
This is a dataset of 60,000 28x28 grayscale images of the 10 digits, along with a test set of 10,000 images. More info can be found at the MNIST homepage. |
Arguments |
path: path where to cache the dataset locally (relative to ~/.keras/datasets). |
Returns |
Tuple of NumPy arrays: (x_train, y_train), (x_test, y_test). |
x_train: uint8 NumPy array of grayscale image data with shapes (60000, 28, 28), containing the training data. Pixel values range from 0 to 255. |
y_train: uint8 NumPy array of digit labels (integers in range 0-9) with shape (60000,) for the training data. |
x_test: uint8 NumPy array of grayscale image data with shapes (10000, 28, 28), containing the test data. Pixel values range from 0 to 255. |
y_test: uint8 NumPy array of digit labels (integers in range 0-9) with shape (10000,) for the test data. |
Example |
(x_train, y_train), (x_test, y_test) = keras.datasets.mnist.load_data() |
assert x_train.shape == (60000, 28, 28) |
assert x_test.shape == (10000, 28, 28) |
assert y_train.shape == (60000,) |
assert y_test.shape == (10000,) |
License: Yann LeCun and Corinna Cortes hold the copyright of MNIST dataset, which is a derivative work from original NIST datasets. MNIST dataset is made available under the terms of the Creative Commons Attribution-Share Alike 3.0 license. |
Reuters newswire classification dataset |
load_data function |
tf.keras.datasets.reuters.load_data( |
path="reuters.npz", |
num_words=None, |
skip_top=0, |
maxlen=None, |
test_split=0.2, |
seed=113, |
start_char=1, |
oov_char=2, |
index_from=3, |
**kwargs |
) |
Loads the Reuters newswire classification dataset. |
This is a dataset of 11,228 newswires from Reuters, labeled over 46 topics. |
This was originally generated by parsing and preprocessing the classic Reuters-21578 dataset, but the preprocessing code is no longer packaged with Keras. See this github discussion for more info. |
Each newswire is encoded as a list of word indexes (integers). For convenience, words are indexed by overall frequency in the dataset, so that for instance the integer "3" encodes the 3rd most frequent word in the data. This allows for quick filtering operations such as: "only consider the top 10,000 most common words, but eliminate the top 20 most common words". |
As a convention, "0" does not stand for a specific word, but instead is used to encode any unknown word. |
Arguments |
path: where to cache the data (relative to ~/.keras/dataset). |
num_words: integer or None. Words are ranked by how often they occur (in the training set) and only the num_words most frequent words are kept. Any less frequent word will appear as oov_char value in the sequence data. If None, all words are kept. Defaults to None, so all words are kept. |
skip_top: skip the top N most frequently occurring words (which may not be informative). These words will appear as oov_char value in the dataset. Defaults to 0, so no words are skipped. |
maxlen: int or None. Maximum sequence length. Any longer sequence will be truncated. Defaults to None, which means no truncation. |