Git Product home page Git Product logo

multivariate-linear-regression's Introduction

Implementation of Multivariate Linear Regression

Aim

To write a python program to implement multivariate linear regression and predict the output.

Equipment’s required:

  1. Hardware – PCs
  2. Anaconda – Python 3.7 Installation / Moodle-Code Runner

Algorithm:

Step1

Import the pandas library using the statement import pandas as pd.

Step2

Import the linear_model module from scikit-learn using the statement from sklearn import linear_model.

Step3

Read the CSV file named "cars.csv" using the pd.read_csv() function and store the data in a DataFrame named df.

Step4

Get the value of X and y variables and Create the linear regression model and fit.

Step5

Predict the CO2 emission using the trained linear regression model by calling the predict() method on regr [[3300, 1300]]

Step6

Print the Predicted CO2

Program:

#Developed by: JANARTHANAN V K
#RegisterNumber: 212222230051

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 CO@ for the corressponding weight and volume",predictedCO2)





Output:

243078936-b21037cf-2d25-44be-9bc1-d12776f4485e

Result

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

multivariate-linear-regression's People

Contributors

janarthanan2 avatar etjabajasphin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.