MNIST Hub
A collection of MNIST classifiers and tools including:
- Generic methods for training, saving and evaluating models
- Interactive GUI for drawing and recognition
- A mini contest mode for comparing different models
Installation
Have Python 3.10 of higher installed. Use Python for which numpy is already compiled which means 3.12 on most platform.
# Create a new conda environment
micromamba create -y -n mnist python=3.12
# Activate the environment
micromamba activate mnist
Install the package:
pip install mnist-hub --upgrade
To install in development mode, clone the source and in the mnist_hub directory type:
pip install -e .
The main runner
The first run will a long time a bit because it has to parse the entire scipy/numpy codebase.
mnist
then it will print somethinw like
Usage: mnist [OPTIONS] COMMAND [ARGS]...
MNIST Hub - A collection of MNIST classifiers and tools.
Options:
-h, --help Show this message and exit.
Commands:
train Train a model and save the fitted model to a file
eval Load a model stored in a file and evaluate it
gui Launch the MNIST GUI application.
contest Run the MNIST contest evaluation.
Usage
The package provides a command line interface with several subcommands:
# Launch the GUI application that you can use
# to test the performance of the models.
mnist gui
# Train a custom model, on just 100 training samples and save to a file.
mnist train mnist.svm.Network --limit 100 --fname foo.gz
# Evaluate the saved model
mnist eval --fname foo.gz
# Run the contest evaluation
mnist contest
Development
In development mode clone the archive and install in editable mode.
# Create environment
micromamba create -y -n mnist python
# Activate the environment
micromamba activate mnist
# Install in editable mode
pip install -e .
Training different models
Your can train any valid Python class that implements the train(trainig_data)and predict(data) methods.
Look at the minst.toy.Toy class for an example API.
You can train new models using the CLI:
# Move the toy model to current directory
cp src/mnist/toy.py foo.py
# Train the new model
mnist train foo.Toy --fname toy_model.gz
# Evaluate the model in the file.
mnist eval --fname toy_model.gz
If you cannot import a valid python module it probabaly means it is not on the PYTHONPATH:
# Add the current directory to the PYTHONPATH
export PYTHONPATH=$PYTHONPATH:.
Interesting observations
Neural Network models are massively faster to evaluate than SVM models.
Evaluating a pre-trained Neural Network model on 10000 test data takes just 0.15 seconds, while an SVM model takes about 61 seconds for the same task.
The MNIST Contest
Can you beat a neural model? Try the contest mode:
mnist contest
Keep guessing!
Metadata
Release files for mnist-hub 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mnist_hub-0.1.4.tar.gz | 20.3 MB | Without provenance | Details for mnist_hub-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mnist_hub-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for mnist_hub-0.1.4-py3-none-any.whl |
Total release size: 40.6 MB
Release files / mnist_hub-0.1.4.tar.gz
| Download URL | mnist_hub-0.1.4.tar.gz |
|---|---|
| Size | 20.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
21b256928c6e541f5c97a8996f178d62edc32d2b3ed00d51aed108c484f73bb9
|
|
BLAKE2b-256 checksum How to use checksums |
dd1a5e3794ef42057c1a060e4f55e9557b5c506defdae17695c8b5dcc7595433
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / mnist_hub-0.1.4-py3-none-any.whl
| Download URL | mnist_hub-0.1.4-py3-none-any.whl |
|---|---|
| Size | 20.3 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0e3e0a0880224f2df0ef27dd705a87dd347dbe797933e707916c9c7acf29b49d
|
|
BLAKE2b-256 checksum How to use checksums |
16eec214691a43f7775e542b2a2fa974462139fe249dccb2bff7bcdc8888cfa3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Security for mnist-hub 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.