Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Linear Regression in Python and C++

This repository demonstrates how to implement linear regression from scratch in both Python and C++. It includes a dataset used for predicting food delivery times.

Contents

  • Food_Delivery_Time_Prediction.csv: Dataset containing features and the target variable for model training.
  • Linear_regression.py: Python implementation of linear regression using gradient descent. The script loads the dataset, normalizes features, trains a model, evaluates performance (e.g., Mean Squared Error), and can plot results.
  • Linear_Regression.cpp: C++ implementation of linear regression using a similar approach, with an emphasis on low‑level control and efficiency.

Data

The Food_Delivery_Time_Prediction.csv dataset includes features such as order preparation time, delivery distance, and weather conditions. The target column is the delivery time. The goal is to learn how these factors influence delivery duration using linear regression.

Usage

Python

Install dependencies (pandas, numpy, matplotlib if needed) and run:

python Linear_regression.py

The script will load the dataset, train the model, and output training progress and evaluation metrics.

C++

Compile and run the C++ version with a C++11 compiler:

g++ -std=c++11 Linear_Regression.cpp -o linear_regression
./linear_regression

This will train the model using the dataset and print results to the console.

Motivation

Building models from scratch in multiple languages helps deepen understanding of linear regression and machine learning fundamentals. Python offers rapid development and visualization, while C++ provides insight into memory management and performance optimization.

Feel free to explore and modify the code or dataset to experiment with feature engineering, learning rates, and optimization strategies.

About

From-scratch linear regression in Python and C++ with gradient descent, evaluation, and reproducible fundamentals.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages