diff --git a/README.md b/README.md index 18362d83..633ad138 100644 --- a/README.md +++ b/README.md @@ -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 -
- +import pandas as pd. ### Step2 -
- +Read the csv file. ### Step3 -
- +Get the value of X and y variables. ### Step4 -
- +Create the linear regression model and fit. ### Step5 -
- +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 - -
+![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. \ No newline at end of file +Thus the multivariate linear regression is implemented and predicted the output using python program.