Skip to content

Commit

Permalink
Rename MNIST and CIFAR-10 dataset Keras libraries
Browse files Browse the repository at this point in the history
Clarify that these libraries are Keras-specific; we may choose to add similar
libraries later for other frameworks, so this will help clarify the distinction.

No functional changes.
  • Loading branch information
mbrukman committed Apr 6, 2024
1 parent 678e1d7 commit 49d815d
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
# limitations under the License.
"""CIFAR-10 dataset provider."""

# From Python 3.9 and onward, `tuple`, `list` and other collection classes can
# also function as generic class types (see PEP 585).
#
# Once we no longer need to support Python 3.7 or 3.8, we can remove this syntax
# (added in PEP 563) for Python 3.7 and higher.
from __future__ import annotations

import numpy as np
Expand Down
4 changes: 2 additions & 2 deletions datasets/mnist/MNIST_-_Exploratory_Data_Analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -356,14 +356,14 @@
"source": [
"## Using the library to simplify input and label transformations\n",
"\n",
"This directory provides [`mnist.py`][mnist-github] library which includes the\n",
"This directory provides [`mnist_keras.py`][mnist-github] library which includes the\n",
"above transformations for scaling the input and converting the labels to a\n",
"categorical (one-hot) representation from the default numeric values, so you\n",
"can use it to simplify the data setup for training and testing MNIST models.\n",
"\n",
"You can see examples of how the library can be used in the [LeNet notebooks][lenet].\n",
"\n",
"[mnist-github]: https://raw.githubusercontent.com/mbrukman/reimplementing-ml-papers/main/datasets/mnist/mnist.py\n",
"[mnist-github]: https://raw.githubusercontent.com/mbrukman/reimplementing-ml-papers/main/datasets/mnist/mnist_keras.py\n",
"[lenet]: https://github.com/mbrukman/reimplementing-ml-papers/tree/main/lenet"
]
}
Expand Down
5 changes: 5 additions & 0 deletions datasets/mnist/mnist.py → datasets/mnist/mnist_keras.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
# limitations under the License.
"""MNIST dataset provider."""

# From Python 3.9 and onward, `tuple`, `list` and other collection classes can
# also function as generic class types (see PEP 585).
#
# Once we no longer need to support Python 3.7 or 3.8, we can remove this syntax
# (added in PEP 563) for Python 3.7 and higher.
from __future__ import annotations

import numpy as np
Expand Down
4 changes: 2 additions & 2 deletions lenet/LeNet_Keras_v1_basic_implementation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"done\n",
"\n",
"# Download our library for processing MNIST dataset.\n",
"for module in mnist ; do\n",
"for module in mnist_keras ; do\n",
" if ! [ -f \"${module}.py\" ]; then\n",
" curl -sO \"https://raw.githubusercontent.com/${GH_USER}/${GH_REPO}/${GH_BRANCH}/datasets/mnist/${module}.py\"\n",
" fi\n",
Expand Down Expand Up @@ -185,7 +185,7 @@
"source": [
"%%capture --no-stderr\n",
"\n",
"from mnist import MNIST\n",
"from mnist_keras import MNIST\n",
"\n",
"# This will download the MNIST dataset via the Keras library which outputs data\n",
"# to stdout, so we silence it above to avoid extraneous output.\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"done\n",
"\n",
"# Download our library for processing MNIST dataset.\n",
"for module in mnist ; do\n",
"for module in mnist_keras ; do\n",
" if ! [ -f \"${module}.py\" ]; then\n",
" curl -sO \"https://raw.githubusercontent.com/${GH_USER}/${GH_REPO}/${GH_BRANCH}/datasets/mnist/${module}.py\"\n",
" fi\n",
Expand Down Expand Up @@ -173,7 +173,7 @@
"source": [
"%%capture --no-stderr\n",
"\n",
"from mnist import MNIST\n",
"from mnist_keras import MNIST\n",
"\n",
"# This will download the MNIST dataset via the Keras library which outputs data\n",
"# to stdout, so we silence it above to avoid extraneous output.\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"done\n",
"\n",
"# Download our library for processing MNIST dataset.\n",
"for module in mnist ; do\n",
"for module in mnist_keras ; do\n",
" if ! [ -f \"${module}.py\" ]; then\n",
" curl -sO \"https://raw.githubusercontent.com/${GH_USER}/${GH_REPO}/${GH_BRANCH}/datasets/mnist/${module}.py\"\n",
" fi\n",
Expand Down Expand Up @@ -200,11 +200,11 @@
"source": [
"%%capture --no-stderr\n",
"\n",
"import mnist\n",
"from mnist_keras import MNIST\n",
"\n",
"# This will download the MNIST dataset via the Keras library which outputs data\n",
"# to stdout, so we silence it above to avoid extraneous output.\n",
"mnist_data = mnist.MNIST()\n",
"mnist_data = MNIST()\n",
"mnist_input_range = (-0.1, 1.175)"
]
},
Expand Down

0 comments on commit 49d815d

Please sign in to comment.