{"id":25180359,"url":"https://github.com/mpieper19/machine-learning-model-comparision-with-cifar10","last_synced_at":"2026-05-09T06:02:17.541Z","repository":{"id":274261342,"uuid":"908601097","full_name":"mpieper19/Machine-Learning-model-comparision-with-CIFAR10","owner":"mpieper19","description":"School Project for our \"Intro to Machine Learning\" course. Was done in collaboration with two other students. This project compares the accuracy and performance of standardized machine learning models (e.g. KNN, LightGBM, etc.) against our built CNN, on the CIFAR-10 Dataset.","archived":false,"fork":false,"pushed_at":"2025-02-07T10:34:29.000Z","size":2023,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-11T22:48:31.190Z","etag":null,"topics":["cifar10","cnn-classification","convolutional-neural-networks","image-classification","keras","keras-tensorflow","machine-learning","scikitlearn-machine-learning","tensorflow"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mpieper19.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-12-26T13:25:46.000Z","updated_at":"2025-02-07T10:34:32.000Z","dependencies_parsed_at":"2025-09-11T21:45:43.721Z","dependency_job_id":"799a8307-a2d8-4123-9cbf-dcd7189add90","html_url":"https://github.com/mpieper19/Machine-Learning-model-comparision-with-CIFAR10","commit_stats":null,"previous_names":["mpieper19/machine-learning-model-comparision-with-cifar10"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mpieper19/Machine-Learning-model-comparision-with-CIFAR10","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpieper19%2FMachine-Learning-model-comparision-with-CIFAR10","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpieper19%2FMachine-Learning-model-comparision-with-CIFAR10/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpieper19%2FMachine-Learning-model-comparision-with-CIFAR10/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpieper19%2FMachine-Learning-model-comparision-with-CIFAR10/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mpieper19","download_url":"https://codeload.github.com/mpieper19/Machine-Learning-model-comparision-with-CIFAR10/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpieper19%2FMachine-Learning-model-comparision-with-CIFAR10/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32809147,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"online","status_checked_at":"2026-05-09T02:00:06.633Z","response_time":123,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cifar10","cnn-classification","convolutional-neural-networks","image-classification","keras","keras-tensorflow","machine-learning","scikitlearn-machine-learning","tensorflow"],"created_at":"2025-02-09T16:17:45.091Z","updated_at":"2026-05-09T06:02:17.523Z","avatar_url":"https://github.com/mpieper19.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Machine-Learning-model-comparision-with-CIFAR10 (Uni Project)\nIntro to Machine Learning WBAI056\n\n## Table of Contents\n- [About the Proejct](#about-the-project)\n- [Built With](#built-with)\n- [Usage](#usage)\n- [Results](#results)\n\n## About the Project\n\nThis project was conducted with two other students, where we comapre the accuracy and effectiveness of a (custom-built) Convolutional Neural Network (CNN), to a handful of other standard machine learning models, on the CIFAR-10 dataset. The following machine learning models are used:\n- K-Nearest-Neighbors (KNN)\n- Light-Gradient-Boosting-Model (LightGBM)\n- CatBoost\n- Random Forest Classifier\n\n## Built With\n- Python\n- Tensorflow\n- Keras\n- Scikit Learn\n- Numpy\n- Pandas\n- Matplotlib\n- Seaborn\n- Catboost\n- LightGBM\n\nUse `pip install -r requirements.txt` to install required dependencies.\n\n## Usage\n\nTo test and run each model, configure the `main.py` file according to the desired model:\n\n### For the CNN Model:\n- Use the `train_and_evaluate_CNN()` function to train and evaluate the CNN model.\n- Ensure the following:\n  - One-hot encoding for labels is enabled (`one_hot=True`).\n  - Image flattening is disabled (`flatten=False`), as the CNN processes structured image data.\n- Results, including training/validation loss and accuracy curves, ROC/AUC curves, the model object, and classification reports, will be saved in the `results` directory.\n\nRun the CNN model with the following code:\n```python\naccuracy, results = train_and_evaluate_CNN()\n```\n\n### For Classic Machine Learning Models:\n- Use the `train_and_evaluate_model(model_code, model_name)` function for classic models. `model_code` and `model_name` can be retrieved from the `_model_map` dictionary found in `models\\__init__.py`.\n```python\n_model_map = {\n    'cnn': CNNModel,\n    'knn': KNNModel,\n    'lgbm': LGBM,\n    'cat': CatBoosst,\n    'forest': RFCModel\n}\n```\n- Ensure the following:\n  - Set `flattenn=True` to prepare the images as 1D vectors, as required by classic ML models.\n- Results, including confusion matrices, ROC/AUC curves, the model object, and classification reports, will be saved in the `results` directory.\n\nRun the CNN model with the following code:\n```python\naccuracy, results = train_and_evaluate_model(\"knn\", \"KNN\")\n```\nFor example, to train the Random Forest model:\n```python\naccuracy, results = train_and_evaluate_model(\"forest\", \"RandomForest\")\n```\n\n## Results\n\nThe classification reports for the models are saved as CSV files in the `results/reports/` directory. For example:\n- [CNN Classification Report](results/reports/CNN_classification_report.csv)\n- [KNN Classification Report](results/reports/KNN_classification_report.csv)\n- [Random Forest Classifier Classification Report](results/reports/randomforest_classification_report.csv)\n- [LightGBM Classification Report](results/reports/LightGBM_classification_report.csv)\n- [CatBoost Classification Report](results/reports/CatBoost_classification_report.csv)\n\n### CNN Results:\nCNN Accuracy: **70%**\n\nCNN Training and Validation Loss Plot:\n\n![image](https://github.com/user-attachments/assets/7141c367-967f-4cda-83fa-aa63baef773d)\n\n\nCNN Training and Validation Accuracy Plot:\n\n![image](https://github.com/user-attachments/assets/24139414-1d56-4715-92da-adf74a6753ec)\n\n\nCNN ROC/AUC Curve:\n\n![image](https://github.com/user-attachments/assets/610943af-d81c-4373-b59f-1c4ae041b205)\n\n### KNN Results:\nKNN Accuracy: **32%**\n\nKNN Confusion Matrix:\n\n![image](https://github.com/user-attachments/assets/680a207f-a2cc-4b79-b7de-c40811093a66)\n\nKNN ROC/AUC Curve:\n\n![image](https://github.com/user-attachments/assets/2d21f017-664e-4a9c-beb5-5a0404e79d5a)\n\n### Random Forest Classifier Results:\nRandom Forest Classifier accuracy: **46%**\n\nRandom Forest Classifer Confusion Matrix:\n\n![image](https://github.com/user-attachments/assets/9a212798-3e17-48c7-a692-71e2841ad99f)\n\nRandom Forest Classifier ROC/AUC Curve:\n\n![image](https://github.com/user-attachments/assets/6f8961ca-630c-4d1d-a8a7-c68a8215d098)\n\n\n### LightGBM Results:\nLightGBM Accuracy: **53%**\n\nLightGBM Loss Plot:\n![image](https://github.com/mpieper19/Machine-Learning-model-comparision-with-CIFAR10/blob/main/results/visualisations/LightGBM_loss.png)\n\nLightGBM Confusion Matrix:\n\n![image](https://github.com/user-attachments/assets/e76f81ee-c215-46f4-8d4c-400fe483c648)\n\nLightGBM ROC/AUC Curve:\n\n![image](https://github.com/user-attachments/assets/543ef416-8b8e-43ae-89ae-8faab40b0c58)\n\n### CatBoost Results:\nCatBoost Accuracy: **58%**\n\nCatboost Loss Plot:\n\n![image](https://github.com/user-attachments/assets/0828f635-deeb-4949-b61c-d2100d632c99)\n\n\nCatBoost Confusionn Matrix:\n\n![image](https://github.com/user-attachments/assets/6ab7737d-16ef-4392-989e-b11ddc2dff5f)\n\n\nCatBoost ROC/AUC Curve:\n\n![image](https://github.com/user-attachments/assets/b4a42fc1-14ed-4c72-b639-81f79eacf0c1)\n\n\n## License\nThis project is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpieper19%2Fmachine-learning-model-comparision-with-cifar10","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmpieper19%2Fmachine-learning-model-comparision-with-cifar10","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpieper19%2Fmachine-learning-model-comparision-with-cifar10/lists"}