francescopiocirillo/bit-decoding-sgd-logistic-regression
πΆ Logistic regression classifier for bit decoding in binary vectors using stochastic gradient descent (SGD). Features performance evaluation, probabilistic modeling, confusion matrix analysis, and classification error interpretation. Developed in Python with Jupyter Notebook.
πΆ Bit Decoding with Logistic Classification using SGD
This project implements a system for decoding binary sequences using logistic regression trained with Stochastic Gradient Descent (SGD). It was developed as part of a university course project in Data Science (Master's Degree in Computer Engineering at University of Salerno), and showcases the design and evaluation of multiple binary classifiers in Python.
Demonstrates proficiency in Python, logistic regression, stochastic optimization, and machine learning evaluation workflows.
π This project is part of a series of logistic regression case studies. For another similar project, see bayesian-map-vs-logistic-regression.
π Objective
Given a set of 48 binary classification problems, each predicting a bit from a 2D feature vector, the objective is to:
- Train 48 logistic regression models using SGD with constant step-size.
- Analyze model performance to identify the most effective choice of parameters (especially learning rate).
- Decode the binary sequence to reconstruct the original ASCII message hidden in the data.
π Language Note
All code comments are written in Italian, as this project was originally developed in an academic setting in Italy. Nonetheless, the code structure, machine learning approach, and methodology follow international best practices.
The project brief is available both in English and Italian.
π οΈ Techniques Applied
- Binary Logistic Regression with 2D input
- Stochastic Gradient Descent (SGD) optimization
- Binary classification across multiple problems (K=48)
- Confusion matrix and classification error analysis
- Bit decoding from ASCII binary sequence
π Methodology Overview
- Each of the 48 classifiers is trained on a dedicated tranche of a shared dataset.
- Models are trained using constant step-size SGD, and multiple values of the step-size are tested.
- The algorithm tracks performance across iterations, allowing the selection of optimal weights Ξ²(i).
- The decoded output is evaluated for correctness against the target ASCII-encoded phrase.
π Repository Structure
π¦ BIT-DECODING-SGD-LOGISTIC-CLASSIFICATION/
βββ README.md
βββ LICENSE
βββ .gitignore
βββ π data/
β βββ homeworkclass.mat # Dataset MATLAB contenente dati per i 48 classificatori binari
βββ π instructions/
β βββ project_description_logistic_classification_ENGLISH.pdf # Descrizione del progetto in inglese
β βββ project_description_logistic_classification_ITALIAN.pdf # Descrizione del progetto in italiano
βββ π notebooks/
βββ bit_decoding_logistic_classification.ipynb # Notebook Jupyter con implementazione e analisi
π§ͺ Results
- A full logistic regression pipeline was implemented and tested successfully.
- Model performance is sensitive to the choice of step-size; analysis of training dynamics was used to select optimal weights.
- The decoded ASCII message confirms the classification pipeline was correctly implemented.
π Technologies Used
- Language: Python
- Environment: Jupyter Notebook
- Core Methods: Logistic Regression, SGD
- Libraries: NumPy, Matplotlib
π About the Project
This project was created as part of the Data Science & Data Analysis course (2024/2025) for the Masterβs Degree in Computer Engineering at the University of Salerno.
π₯ Team β University of Salerno
π¬ Contacts
βοΈ Got feedback or want to contribute? Feel free to open an Issue or submit a Pull Request!
π SEO Tags
logistic-regression, bit-decoding, binary-classification, stochastic-gradient-descent, machine-learning, jupyter-notebook, classification-metrics, python, data-science, ascii-decoding, supervised-learning, optimization, confusion-matrix
π License
This project is licensed under the MIT License, a permissive open-source license that allows anyone to use, modify, and distribute the software freely, as long as credit is given and the original license is included.
In plain terms: use it, build on it, just donβt blame us if something breaks.
β Like what you see? Consider giving the project a star!