Machine Learning
19ME 3220
III/IV B.Tech
Odd Sem
for the Academic Year 2021-21
Sesion-22
Multiple Variable – Multivarient Regression
S. Ramesh Kumar
Course Co-ordinator
Introduction to
Multivariate Regression
Multivariate Regression is a technique that estimates a
single regression model with more than one outcome
variable.
When there is more than one predictor variable in a
multivariate regression model, the model is a multivariate
multiple regression.
Multivariable regression models are used to establish the
relationship between a dependent variable (i.e. an outcome
of interest) and more than 1 independent variable.
Multivariable regression can be used for a variety of
different purposes in research studies.
Introduction to Multivariate Regression
The aim of multivariate analysis is to find patterns and
correlations between several variables simultaneously.
Multivariate analysis is especially useful for analyzing
complex datasets, allowing you to gain a deeper
understanding of your data and how it relates to real-world
scenarios.
Introduction to Multivariate Regression
Data Handling:
By observing the data set, some of the values are missing and we have to fill the
data point
There is a linear relation between the data points, as the home getting older the
price getting down, so by normal analysis we can decide to apply linear
regression
Linear Eq:
Introduction to Multivariate Regression
Import pandas as pd
1 Import numpy as np
from sklearn import linear_model
2 df = pd.read_csv(“homeprices.csv”)
df
Import math
3 Median_bedrooms = math.floor(df.bedrooms.median())
Median_bedrooms
4
df.bedrooms = df.bedrooms.fillna(median_bedrooms)
df
Clean and prepare the data before training the model with data set.
Introduction to Multivariate Regression
reg = linear_model.LinearRegression()
5
reg.fit(df[[‘area’,’bedrooms’,’age’]],df.price)
6 reg.coef_ array([ 137.25, -26025. , -6825. ]
7 reg.intercept_ 383724.99999999983
8 reg.predict([3000,3,40]) array([ 444400.])
9 137.25 *3000+ -26025 *3+ -6825 *40+383724.99999999983
444399.9999999998
Introduction to Multivariate Regression
Exercise-2
Aim: to predict the salary for the person with the given constraints
1. Two Years of Experience, with test_score:9 and interview score: 6
2. Twelve Years of Experience with test_score:10 and interview score:10