LinearRegPy is a Python project that implements linear regression for predicting data trends using popular libraries such as pandas, numpy, and matplotlib.
Linear regression is a fundamental technique in machine learning and statistics used to model the relationship between a dependent variable and one or more independent variables. This project focuses on implementing linear regression in Python, specifically for predicting trends in datasets.
- Data Preprocessing: The project includes functionality for reading CSV data files into pandas DataFrames, shuffling the data, and splitting it into training and test sets.
- Model Training: Linear regression is performed using the least squares method to find the coefficients of the fitted line.
- Visualization: The project visualizes the original data points, the fitted line, and provides insights into the model's performance using matplotlib.
- Error Calculation: The error between the estimated values and the actual test data values is calculated and displayed.
-
Clone the repository:
git clone https://github.com/alireza-nasirian/LinearRegPy.git
-
Replace the
data.csv
file with your own dataset if necessary. -
Run the
linear_regression.py
script:python linear_regression.py
Contributions are welcome! If you find any bugs or have suggestions for improvement, feel free to open an issue or submit a pull request.