Skip to content

aethnae/mnist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MNIST | Numerik (WS 25/26)

Implementation of a simple MLP in Python. Features a full forward pass, backpropagation and gradient descent. Dependencies include numpy for matrix operations, sklearn for the dataset and confusion matrices, and matplotlib for visualization.

  1. Open the directory in a unix-terminal with bash and create a virtual environment. For fish users, add activate.fish when sourcing.

    python3 -m venv venv
    source venv/bin/activate  # On macOS/Linux
    .\venv\Scripts\activate   # On Windows
  2. Check for dependencies by running

    pip install -r requirements.txt
  3. Execute the script

    python3 main.py

Keep in mind that you have to close every plot manually if you run from the command line.


Argument Passing

We support flexible tweaking of our models hyperparameters with argparse. Just invoke the parameter(s) you want to adjust when running our script via the command line. Some flags that you might want to try are

  • --epochs expects an integer value that sets the training duration.
  • --lr expects a floating-point value to set the learning rate of the model.
  • --hidden expects two integers that set the dimensions of the hidden layers.
  • --loss lets you pick mean-squared error with mse and CrossEntropyLoss with entropy.
  • --activation lets you pick between relu, softplus and sigmoid activation in the hidden layers.

Remember that you can see a list of all possible arguments with python3 main.py -h.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages