Skip to content

Jampana-Jagadeesh/Linear-Regression

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Linear Regression with scikit-learn

This repository contains a Python script for implementing linear regression using scikit-learn. Linear regression is a simple yet powerful algorithm for predicting a continuous target variable based on one or more independent features.

Prerequisites

Before running the script, make sure you have the following libraries installed:

pip install numpy matplotlib pandas scikit-learn

Usage

  1. Clone the repository:
git clone https://github.com/*****/linear-regression.git
cd linear-regression
  1. Run the script:
python linear_regression.py

Make sure to update the file paths in the script to point to your actual dataset files.

Algorithm

The script uses the scikit-learn library to implement linear regression. You can experiment with other regression algorithms by replacing the LinearRegression model with the desired model from scikit-learn.

For example, to use Decision Tree Regression:

from sklearn.tree import DecisionTreeRegressor

# Create a Decision Tree Regression model
model = DecisionTreeRegressor()
# ... rest of the code remains the same

Results

The script calculates Mean Squared Error (MSE) and R-squared (R^2) scores for both the training and test sets. The results are printed, and a plot is generated to visualize the regression line and actual data points.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

About

Linear-Regression by using the Machine Learning

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages