Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 22 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,35 @@ To write a python program to implement multivariate linear regression and predic
2. Anaconda – Python 3.7 Installation / Moodle-Code Runner
## Algorithm:
### Step1
<br>

import pandas as pd.
### Step2
<br>

Read the csv file.
### Step3
<br>

Get the value of X and y variables.
### Step4
<br>

Create the linear regression model and fit.
### Step5
<br>

Predict the CO2 emission of a car where the weight is 2300kg, and the volume is 1300cm cube.
## Program:
```






import pandas as pd
from sklearn import linear_model
df = pd.read_csv("carsemission.csv")
X = df[['Weight', 'Volume']]
y = df['CO2']
regr = linear_model.LinearRegression()
regr.fit(X, y)
print('Coefficients:', regr.coef_)
print('Intercept:',regr.intercept_)
predictedCO2 = regr.predict([[3300, 1300]])
print('Predicted CO2 for the corresponding weight and volume',predictedCO2)
```
## Output:

### Insert your output

<br>
![image](https://github.com/Gokkul-M/Multivariate-Linear-Regression/assets/144870543/4a4ced3d-9d3e-4f0d-9cdf-695807e54e27)
Insert your output
Coefficient: [0.00755095 0.00780526]
Intercept: 79.69471929115939
Predicted CO@ for the corresponding weight and volume [114.75968007]

## Result
Thus the multivariate linear regression is implemented and predicted the output using python program.
Thus the multivariate linear regression is implemented and predicted the output using python program.