Package Exports
- mnist-dataset
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mnist-dataset) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
mnist-dataset
✍️ Yann LeCun's MNIST handwritten digit dataset, made available to Node.js. This library contains all of the utilities you need to download and parse the raw unfiltered dataset, which is expressed as JSON arrays. It uses fs to cache to your system's tmpdir() so that you don't have to keep downloading the dataset between successive executions of your software.
🚀 Getting Started
Using npm:
npm install --save mnist-datasetUsing yarn:
yarn add mnist-dataset✍️ Usage
import { cache, trainingImagesUrl, trainingLabelsUrl } from 'mnist-dataset';
(
async () => {
const trainingImages = await cache(trainingImagesUrl); // [[Number]] (i.e. [[0, 0, 0, ...], [0, 0, 0, ...], ...])
const trainingLabels = await cache(trainingLabelsUrl); // [[Number]] (i.e. [[7], [2], ...])
const toString = e =>
[...Array(28)]
.map((_, i) =>
[...Array(28)].map((_, j) => (e[i * 28 + j] > 128 ? "#" : " ")).join("")
)
.join("\n");
const [number7] = trainingImages;
console.log(toString(number7));
}
)();