This repository contains a collection of machine learning projects covering various fundamental concepts and techniques. Each project demonstrates different aspects of machine learning including classification, regression, regularization, and language modeling.
The repository is organized into four main projects:
Each project has specific dependencies, but the core requirements can be downloaded by running the below command in the root directory (alternatively see each individual folder’s README/requirements.txt to download that specific folder’s requirements only):
pip install -r requirements.txtFor the language modeling project, additional requirements are provided in its dedicated requirements.txt file.
-
Binary Classification with Logistic Regression and SVM
Demonstrates implementation of binary classification models using logistic regression and support vector machines (SVM) on 2D data.
Key Features:- Basic logistic regression with linear decision boundaries
- SVM implementation with parameter tuning (C values)
- Feature engineering by adding squared terms
- Enhanced visualizations with decision boundaries
- Model accuracy comparison against baseline classifiers
Dataset:my_sample_data.csvwith two features and binary target values (1, -1)
-
Binary Classification Techniques
Explores various binary classification algorithms with comparison of their performance characteristics.
Key Features:- Baseline classification models for performance benchmarking
- K-Nearest Neighbors implementation with tunable k values
- Logistic regression with polynomial features
- ROC curve analysis and confusion matrices
- Cross-validation for hyperparameter tuning
Datasets:sample_binary_data_1.csvandsample_binary_data_2.csv
-
Polynomial Regression with Regularization
Implements polynomial regression models with Ridge and Lasso regularization techniques.
Key Features:- Polynomial feature generation
- Lasso regression analysis and visualization
- Ridge regression analysis and visualization
- Cross-validation for regularization parameter tuning
- 3D visualization of prediction surfaces
Dataset:sample_data.csvwith two features and continuous target values
-
Language Modeling with GPT Implementation
Contains a GPT-like language model implementation for text generation and analysis.
Key Features:- Transformer-based model architecture
- Text preprocessing and tokenization
- Transfer learning between different text corpora
- Skip connection analysis
- Bias analysis visualization
Datasets:input_childSpeech_trainingSet.txtinput_childSpeech_testSet.txtinput_shakespeare.txt
- Feature engineering significantly improves classification performance
- Higher regularization (lower C values) creates simpler decision boundaries with better generalization
- KNN performance varies significantly with choice of k value
- Polynomial features enable capturing non-linear relationships
- Degree 5 polynomials capture complex non-linear relationships in the data
- Lasso tends to produce sparse models by setting some coefficients exactly to zero
- Ridge regression shrinks all coefficients but typically keeps them non-zero
- Cross-validation reveals the bias-variance tradeoff when selecting regularization strength
- Transfer learning enables applying models trained on one corpus to another domain
- Skip connections impact model performance and gradient flow
- Potential biases exist in model predictions based on training data
Each project includes extensive visualizations to help understand model behavior:
- Classification Projects: Scatter plots with decision boundaries, ROC curves, confusion matrices
- Regression Project: 3D scatter plots, prediction surfaces, error plots, coefficient value tables
- Language Modeling: Data statistics plots, bias analysis visualizations, architecture diagrams
Navigate to any project directory and run individual scripts:
# For example, to run data visualization in the binary classification project
cd Binary_Classification_with_Logistic_Regression_and_SVM
python data_visualization.py
# To run the GPT implementation
cd Language_Modeling_with_GPT_Implementation
python gpt.py
python data_visualization.pyFor more detailed information about each project, refer to the README files in their respective directories.
This project is open-source and available for educational purposes.