Skip to main content

No project description provided

Project description

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 --name 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:

# Train the new model
mnist train --name mnist.toy.Toy --fname toy_model.gz

# Evaluate the model in the file.
mnist eval --fname toy_model.gz

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!

Project details


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.3.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.3-py3-none-any.whl (20.3 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mnist_hub-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 bb203384a5aa0e33d37af791176182a4c68696205913bf71cb03fe4ccb55027b
MD5 bb77038a44f70b64ba6b0dda546137b2
BLAKE2b-256 cc64757be1c4333544deaa8795fa335810f707c5ab69ae9dfeba96bfeb06f003

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mnist_hub-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b77f84700cccba9cc8c002eee609be0955631d1ab4130a683c839007a9c877bf
MD5 1026dc4d7ad8fc412406c194f3be7c6a
BLAKE2b-256 4480914c51143ace3a38903d4b27c815e23bd8612e28be2d76c6f66ce999d3fb

See more details on using hashes here.

Supported by

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