Skip to content

JustinACoder/Project-COMP472

Repository files navigation

Final Project COMP 472

Info

List of files

For each step described in the project description, there is a single notebook file that contains the code for that step. There may also be an additional .py file for each step if applicable that contains classes to be reused any notebook files.

  • Step 2

    • 2_dataset_overview.ipynb This file contains the code showing preprocessing steps and basic visualization of the data. However, the actual class that loads for the rest of the project is in the file dataset_overview.py.
    • dataset_overview.py This file contains the LimitedCIFAR10 class that is then used in the rest of the project to load the data.
  • Step 3

    • 3_naive_bayes.ipynb This file contains the training and testing of the custom and sklearn implementation of the Gaussian Naive Bayes classifier. However, the actual custom classifier object is defined in the file naive_bayes.py.
    • naive_bayes.py This file contains the GaussianNaiveBayesClassifier class.
  • Step 4

    • 4_decision_tree.ipynb This file contains the training and testing of the custom and sklearn implementation of the Decision Tree classifier. However, the actual custom classifier object is defined in the file decision_tree.py. It runs the different trials while showing preliminary results and plots.
    • decision_tree.py This file contains the DecisionTreeClassifier class.
  • Step 5

    • 5_mlp.ipynb This file contains the training and testing of the main and variants of a MLP classifier. The MLP classifier is defined as SimpleMLP in the file mlp.py. It runs the different trials while showing preliminary results and plots.
  • Step 6

    • 6_cnn.ipynb This file contains the training and testing of the main and variants of a VGG11 CNN classifier. The CNN classifier is defined as CustomVGG11 in the file cnn.py. For the trials, a more flexible class is used called FlexibleVGG11. It runs the different trials while showing preliminary results and plots such as training and testing curves and feature maps.
    • cnn.py This file contains the CustomVGG11 class and the FlexibleVGG11 class.
  • Step 7

    • 7_evaluation.ipynb This file loads back the models and evaluates them on the test set. It also contains the code to generate metrics table and the confusion matrix for each model.

How to run

To run the project, ensure you download the models zip folder from the moodle submission and extract it in a models folder in the root directory such that you can access a model at models/naive_bayes/main_custom_nb.joblib. Then, you can run the notebooks in the order of the steps to reproduce the results. Make sure to run the cells in order as some cells depend on previous cells to be run and some variables are reused. (You do not have to run the .py files as they are only used as imports in the notebooks)

Models: https://drive.google.com/file/d/1-k78puZ9gwwkCJMNDf6rCcEeU3KN33xX/view?usp=sharing

WARNING: re-running the notebooks will overwrite the models in the models folder. If you want to keep the models, make sure to move them to another folder before re-running the notebooks.

Libraries used

scikit-learn torch numpy pandas (used once for exporting the metrics table to a csv file for the report) matplotlib joblib (for saving and loading models not with torch) (and other standard libraries like os, time, etc.)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors