To write a python program to implement multivariate linear regression and predict the output.
- Hardware – PCs
- Anaconda – Python 3.7 Installation / Moodle-Code Runner
#Developed by: ABINAYA S
#RegisterNumber: 212222230002
import pandas as pd
from sklearn import linear_model
df=pd.read_csv('/content/cars.csv')
x=df[['Weight','Volume']]
y=df['CO2']
regr=linear_model.LinearRegression()
regr.fit(x,y)
print("Coefficient:",regr.coef_)
print("Intercept:",regr.intercept_)
predictedCO2=regr.predict([[3300,1300]])
print("Predicted CO2 for the corresponding weight and volume",predictedCO2)
Thus the multivariate linear regression is implemented and predicted the output using python program.