Skip to main content

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!

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mnist_hub-0.1.4.tar.gz (20.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mnist_hub-0.1.4-py3-none-any.whl (20.3 MB view details)

Uploaded Python 3

File details

Details for the file mnist_hub-0.1.4.tar.gz.

File metadata

  • Download URL: mnist_hub-0.1.4.tar.gz
  • Upload date:
  • Size: 20.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for mnist_hub-0.1.4.tar.gz
Algorithm Hash digest
SHA256 21b256928c6e541f5c97a8996f178d62edc32d2b3ed00d51aed108c484f73bb9
MD5 a1a5e4b04c835f216817963740b66a3d
BLAKE2b-256 dd1a5e3794ef42057c1a060e4f55e9557b5c506defdae17695c8b5dcc7595433

See more details on using hashes here.

File details

Details for the file mnist_hub-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: mnist_hub-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 20.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for mnist_hub-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0e3e0a0880224f2df0ef27dd705a87dd347dbe797933e707916c9c7acf29b49d
MD5 5d9a5948d47c6c636148456a8723bc64
BLAKE2b-256 16eec214691a43f7775e542b2a2fa974462139fe249dccb2bff7bcdc8888cfa3

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 files

0.1.3

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page