top of page

Machine Learning Tutorial

Public·1 member

Linear Regression In Machine Learning


Table of Contents


Here some important points or content so we can easily understand all the concepts of linear regression


  • What is a Linear Regression?

  • How to represent of Linear Regression

  • Training a Linear Regression model

  • Evaluating the model


What is a Linear Regression?


The Linear regression model is used to find a relationship between one or more features(independent variables) and a continuous target variable(dependent variable).


How to represent Linear Regression?


The mathematical equation to represent the linear regression :












First import the all related libraries:


import numpy as np
import matplotlib.pyplot as plt  
# To visualize
import pandas as pd  
# To read data
from sklearn.linear_model import LinearRegression

After this training the data:

data = pd.read_csv('filename.csv')  
# load data set
X = data.iloc[:, 0].values.reshape(-1, 1)  
# values converts it into a numpy array
Y = data.iloc[:, 1].values.reshape(-1, 1)


Fit it into the model:


We can fit the linear regression into the model.

linear_regressor = LinearRegression()  
# create object for the class
linear_regressor.fit(X, Y)  
# perform linear regression
Y_pred = linear_regressor.predict(X)  
# make predictions

#machinelearning #python #datascience


Are you looking for help in Linear Regression Assignment, Coursework, Project and capstone project Help? please contact us now and get your project or Linear Regression task by Linear Regression experts at affordable price


Enquiry us now
contact@codersarts.com
10 Views
bottom of page