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.0.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.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mlpclassifier-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 0cd98bf88bcc72ba5458b962ae6a185b8d769913d5fac9bc50095aabaafb29fc
MD5 51bf77d7edb48812ea4fb1e684f1fe39
BLAKE2b-256 40a625d2f56c89e1f042be1f9b4c3ece4cc102192d2d20dc2c344b0eb0e42473

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mlpclassifier-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0059ded272cfd0475de0b0a80d876a1bf2e1a13e52a8e4d726b442d5bf6f8856
MD5 22a6f2ea89b295ad4875118fb5ec34e7
BLAKE2b-256 0fe6519e2ed9acf29417addf8861e0122f32f0310fd770950726c01b0a9b05bd

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