Skip to main content

An implementation of an MLP classifier (with an interface of that of scikit-learn's MLPClassifier class.

Project description

Neural-Network-From-Scratch-COSC-221-CSB

Neural Network to classify handwritten digits (a rite of passage project at this point lol).

We will try to re-implement a stripped down version of the MLPClassifier class from scikit-learn from first principles. With this, we can then train a general classifier using the Multi-Layered Perceptron model.

To run

So since we've re-implemented an MLP using scikit-learn's MLPClassifier as a template, the API should be familiar.

To import

Dataset

Download the dataset from Kaggle

curl -L https://www.kaggle.com/api/v1/datasets/download/hojjatk/mnist-dataset -o ./dataset.zip

Then just unzip it into a directory called ./dataset

unzip -d dataset ./dataset.zip

Optional, but clean redundancy:

rm -r *-idx*-ubyte

I've removed some duplicates, so currently I have:

$ ls ./dataset/
 t10k-images.idx3-ubyte   train-images.idx3-ubyte
 t10k-labels.idx1-ubyte   train-labels.idx1-ubyte

So it seems like by convention:

  • we divide our dataset into training data, and then testing data
  • currently, it seems like we have 60k training examples and 10k testing examples
  • they do this to see how well the model has generalized

Reference model

For now, we'll use a reference model through scikit-learn.

TODO

  • debug all the row vector stuff
  • [] package it in pip
  • [] document the API

Forward propagation

  • variable L for layer
  • a list $n^{[l]}$ for the size at each layer
  • [] initialize using He's initalization
  • forward propagation step using that forward propagation formula

Backward propagation

  • He's initialization
  • back propagation
  • scoring
  • saving
  • [] make the learn rate $\alpha$ more adjustable

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

mlpclassifier-0.1.1.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

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

mlpclassifier-0.1.1-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file mlpclassifier-0.1.1.tar.gz.

File metadata

  • Download URL: mlpclassifier-0.1.1.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for mlpclassifier-0.1.1.tar.gz
Algorithm Hash digest
SHA256 573bb68118e0f4da85dd69b0173c6401e429eb3130051100ec051125f3aba30e
MD5 10c78ad74f0a41a5ea0a9856d669625f
BLAKE2b-256 80d4b09a1a41189a94f4ce393e8343658776849a8b123617ec94e9f667e9446a

See more details on using hashes here.

File details

Details for the file mlpclassifier-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: mlpclassifier-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for mlpclassifier-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5a2d981fa41517b4e654c24f6fa515300964567e072c921e9c988297f76a1a3a
MD5 25d0c973d54531521db619a85289d33b
BLAKE2b-256 024c85258a6f2a23f64ac812bce2f3ef5a8c22a3224f27e4cb9c524209e9c247

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