To write a python program to implement multivariate linear regression and predict the output.
- Hardware – PCs
- Anaconda – Python 3.7 Installation / Moodle-Code Runner
Import pandas.
Impor linear model from sklearn.
Read the files cars.csv.
Assign he values for x and y as requried.
Create the LinearRegression model and predic he output.
Developed by: Lokesh N
Register No: 212222100023
import pandas as pd
from sklearn import linear_model
df=pd.read_csv("/content/cars (1).csv")
a=df[['Weight','Volume']]
b=df[['CO2']]
regr=linear_model.LinearRegression()
regr.fit(a,b)
print("Coefficient: ",regr.coef_)
print("Intercept:",regr.intercept_)
print("Account",regr.predict([[3300,1300]]))
Thus the multivariate linear regression is implemented and predicted the output using python program.