{"id":19953093,"url":"https://github.com/pejpero/multi-class_classifier","last_synced_at":"2025-03-01T15:17:38.068Z","repository":{"id":251232349,"uuid":"836801387","full_name":"PejperO/Multi-class_Classifier","owner":"PejperO","description":"This project demonstrates multiclass classification using Perceptron and Logistic Regression, implemented from scratch without using built-in libraries. It includes techniques like One-Versus-The-Rest and One-Versus-One for Perceptron, and Softmax for Logistic Regression, with a focus on understanding core ML concepts.","archived":false,"fork":false,"pushed_at":"2024-08-03T09:30:04.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-12T06:27:33.436Z","etag":null,"topics":["data-visualization","logistic-regression","machine-learning","multiclass-classification","one-vs-one","one-vs-rest","perceptron","python","scratch-implementation","softmax"],"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/PejperO.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}},"created_at":"2024-08-01T15:28:55.000Z","updated_at":"2024-08-03T09:30:07.000Z","dependencies_parsed_at":"2025-01-12T06:26:12.280Z","dependency_job_id":"98596e13-7ba7-4629-832e-bd613d5322bc","html_url":"https://github.com/PejperO/Multi-class_Classifier","commit_stats":null,"previous_names":["pejpero/multi-class_classifier"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PejperO%2FMulti-class_Classifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PejperO%2FMulti-class_Classifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PejperO%2FMulti-class_Classifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PejperO%2FMulti-class_Classifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PejperO","download_url":"https://codeload.github.com/PejperO/Multi-class_Classifier/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241381648,"owners_count":19953752,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["data-visualization","logistic-regression","machine-learning","multiclass-classification","one-vs-one","one-vs-rest","perceptron","python","scratch-implementation","softmax"],"created_at":"2024-11-13T01:15:23.673Z","updated_at":"2025-03-01T15:17:38.046Z","avatar_url":"https://github.com/PejperO.png","language":"Python","readme":"# Multiclass Classification with Perceptron and Logistic Regression\n\n## Project Overview\nThis project demonstrates the implementation of multiclass classification using two machine learning algorithms: Perceptron and Logistic Regression. The aim is to understand and implement these algorithms from scratch, avoiding the use of built-in classifiers from libraries such as sklearn and numpy. This hands-on approach helps in gaining a deeper understanding of how these algorithms work.\n\n## Technology and Implementation\n### Perceptron\nThe Perceptron is a simple binary classifier that can be extended to handle multiple classes using techniques such as One-Versus-The-Rest (OvR) and One-Versus-One (OvO).\n\n1. One-Versus-The-Rest (OvR): This technique involves training one classifier per class, with the samples of that class as positive samples and all other samples as negatives.\n2. One-Versus-One (OvO): This technique involves training a classifier for every pair of classes. For a problem with k classes, k*(k-1)/2 classifiers are trained.\n\n### Logistic Regression\nLogistic Regression can also be extended for multiclass classification using the Softmax function, transforming model outputs into probability distributions over the classes.\n\n### Dataset\n- Generated a dataset with 2 coordinates (x1, x2), 4 clusters (4 classes), and 50 points per cluster.\n- Dataset split into 80% training and 20% testing sets.\n\n### Files\n- **both_techniques.py:** Contains the implementation of Perceptron classifier using OvR and OvO techniques.\n- **logistic_regression.py:** Contains the implementation of Logistic Regression for multiclass classification using the Softmax function.\n\n## Results\nPerceptron One-Versus-The-Rest\n\n![One-Versus-The-Rest](https://github.com/user-attachments/assets/ef1ce8c7-bf95-4bd8-ac04-1e584140c0dd)\n\nPerceptron One-Versus-One\n\n![One-Versus-One](https://github.com/user-attachments/assets/b7dfafb3-0339-4510-89c2-266467f7070e)\n\nLogistic Regression Multiclass Classification \n\n![Multiclass](https://github.com/user-attachments/assets/6981b8f2-dc11-4ccd-9f9b-9a55efe5d353)\n\n## Conclusion\nThis project illustrates the implementation of multiclass classification using Perceptron and Logistic Regression from scratch. By avoiding built-in classifiers, the goal is to deepen the understanding of these fundamental algorithms in machine learning.\n\n## Usage\n1. Clone the Repository\n``` bash\ngit clone https://github.com/yourusername/multiclass-classification.git\ncd multiclass-classification\n```\n\n2. Run Perceptron Classifier\n``` bash\npython both_techniques.py\n```\n\n3. Run Logistic Regression Classifier\n```bash\npython logistic_regression.py\n```\n\n## What I Learned\n**Data Generation:**\n- How to generate synthetic datasets with specified means and standard deviations.\n- Importance of dataset splitting for training and testing.\n\n**Perceptron Algorithm:**\n- Implementation of a basic binary Perceptron classifier.\n- Extension of binary Perceptron to multiclass classification using OvR and OvO techniques.\n- Handling class imbalance and converting multiclass labels to binary.\n\n**Logistic Regression:**\n- Building a Logistic Regression model from scratch.\n- Application of the Softmax function for multiclass classification.\n- Understanding gradient descent for parameter optimization.\n\n**Visualization:**\n- Plotting decision boundaries to visually assess the classifier performance.\n- Importance of visual aids in understanding model behavior.\n\n**Accuracy Calculation:**\n- Methods to evaluate model accuracy on test data.\n- Differences in performance metrics across different classification techniques.\n\n**General Machine Learning Concepts:**\n- The significance of not using built-in libraries for educational purposes.\n- The trade-offs between different multiclass classification techniques (OvR vs OvO).\n- The practical challenges in implementing machine learning algorithms from scratch.\n\n## License\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpejpero%2Fmulti-class_classifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpejpero%2Fmulti-class_classifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpejpero%2Fmulti-class_classifier/lists"}