Skip to content

Latest commit

 

History

19 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logistic Regression from Scratch - C++

Current Status

This project implements Logistic Regression from scratch in C++ with CUDA acceleration, featuring modular libraries for Matrix operations, Statistical computations, and GPU-optimized implementations.


Phase 0: Foundation & Core Libraries ✅ COMPLETE

  • Matrix Library: Full CPU implementation with constructors, operations, and vector operations
  • Statistics Library: Descriptive statistics, correlation, normalization, and quartiles
  • Project Structure: Organized modular architecture with cpp_lib and cuda_lib separation
  • Build System: Makefile-based compilation for all modules
  • Dataset Integration: Training and test CSV datasets prepared

Phase 1: Algorithm Implementation ⏳ IN PROGRESS (README)

  • Logistic Regression (CPU): Core implementation with multiple optimization methods
  • Gradient Descent Variants: Batch, Stochastic, and Mini-Batch implementations
  • Cost Functions: Cross-entropy loss and regularization support
  • Prediction Pipeline: Inference module for trained models
  • Python Bindings: Seamless integration with Python for data science workflows

Phase 2: GPU Acceleration ⏳ IN PROGRESS

  • CUDA Matrix Operations: GPU-accelerated matrix computations
  • CUDA Memory Management: Efficient GPU memory allocation and transfer
  • GPU Kernels: Optimized CUDA kernels for core operations
  • CPU-GPU Interface: Seamless data transfer between CPU and GPU
  • Training Scripts: train_logreg.py for model training
  • Prediction Module: predict_logistic.py for inference

Phase 3: Optimization & Performance ⏳ IN PROGRESS

  • Benchmark CPU vs CUDA implementations
  • Optimize memory allocation patterns in CUDA kernels
  • Implement advanced gradient descent variants (Adam, RMSprop)
  • Profile and optimize bottlenecks

Phase 4: Testing & Validation 📋 PENDING

  • Comprehensive unit tests for all modules
  • Integration tests for CPU-GPU consistency
  • Regression tests on standard datasets
  • Numerical accuracy validation

Phase 5: Documentation & Examples 📋 PENDING

  • Detailed API documentation for each module
  • Performance comparison benchmarks
  • Real-world usage examples
  • Troubleshooting guide

Project Structure

dslr/
├── cpp_lib/              # CPU implementations
│   ├── Matrix/          # Matrix operations library
│   ├── Stats/           # Statistics library
│   └── LogisticRegression/  # Main ML model
├── cuda_lib/            # GPU implementations
│   ├── MatrixCuda/      # CUDA matrix operations
│   └── Stats/           # CUDA statistics
├── datasets/            # Training and test data
├── train_logreg.py      # Training script
└── predict_logistic.py  # Prediction script

Next Immediate Steps

  1. Benchmark Suite - Compare CPU vs GPU performance metrics
  2. Unit Testing Framework - Implement comprehensive tests for all modules
  3. Documentation - Generate API docs and usage examples
  4. Performance Profiling - Identify and optimize bottlenecks

Resources

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages