0% found this document useful (0 votes)
116 views

Machine Learning Assignment 2

If you had to invest in a company, you would definitely like to know how much money you could expect to make. Let’s take a look at a venture capitalist firm and try to understand which companies they should invest in. First, we need to figure out:  the companies to invest in.  the profit the company makes.  the company's expenses. Now that we have our company’s data for different expenses, marketing, location and the kind of administration, we would like to calculate the profit based on all t

Uploaded by

ahsan rabbani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
116 views

Machine Learning Assignment 2

If you had to invest in a company, you would definitely like to know how much money you could expect to make. Let’s take a look at a venture capitalist firm and try to understand which companies they should invest in. First, we need to figure out:  the companies to invest in.  the profit the company makes.  the company's expenses. Now that we have our company’s data for different expenses, marketing, location and the kind of administration, we would like to calculate the profit based on all t

Uploaded by

ahsan rabbani
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

MACHINE LEARNING

E&ICT ACADEMY IIT ROORKEE


PROFIT ESTIMATION OF A COMPANY USING SKLEARN LINEAR
REGRESSION
Assignment:2

AHSAN RABBANI
Assistant Professor
Department of Civil Engineering
Darbhanga College of Engineering, Darbhanga, Bihar

Profit Estimation of a Company


If you had to invest in a company, you would definitely like to know how much money
you could expect to make. Let’s take a look at a venture capitalist firm and try to
understand which companies they should invest in. First, we need to figure out:

 the companies to invest in.


 the profit the company makes.
 the company's expenses.

Now that we have our company’s data for different expenses, marketing, location
and the kind of administration, we would like to calculate the profit based on all this
different information.
Let's consider a single variable-R&D and find out which companies to invest in. We
will now be plotting the profit based on the R&D expenditure and how much money
they put into the research and development and then we will look at the profit that
goes with that.
We have to draw a line through the data and when you look at that you can see how
much they have invested in the R&D and how much profit it is going to make. We
can also observe that the company that is spending more on R&D make good profits
and thereby we invest in the ones that spend a higher rate in their R&D.

Applications of Linear Regression


Few applications of Linear Regression mentioned below are:

 To determine the economic growth of a country or a state in the coming quarter.


 Can also be used to predict the GDP of a country.
 To predict what would be the price of a product in the future.
 To predict the number of runs a player will score in the coming matches.

How Decision Trees Perform Regression


Let us look at the steps to perform Regression using Decision Trees.
 The dataset looks similar to classification DT. The main difference is that instead of
predicting class, each node predicts value.
 This value represents the average target value of all the instances in this node.
 This prediction has an associated MSE or Mean Squared Error over the node instances.
 This mean value of the node is the predicted value for a new data instance that ends up
in that node.

Solving Linear Regression


Find parameters θ that minimize the least squares (OLS) equation, also called Loss
Function:

This decreases the difference between observed output [h(x)] and desired output [y].

Learning the Parameters


There are two ways to learn the parameters:
1. Normal Equation: Set the derivative (slope) of the Loss function to zero (this
represents minimum error point).
2. LMS Algorithm: The minimization of the MSE loss function, in this case, is
called LMS (least mean squared) rule or Widrow-Hoff learning rule. This
typically uses the Gradient Descent algorithm.

Deriving Normal Equation


To minimize MSEtrain, solve the areas where the gradient (or slope ) with respect to
weight w is 0.

This can be simplified as: w = (XT .X)-1 .XT .y This is called the Normal Equation.

LMS Algorithm
In the case of Linear Regression, the hypotheses are represented as:

Where θi ’s are parameters (or weights). θi ’s can also be represented as θ0*x0 where x0 = 1,
so:
The cost function (also called Ordinary Least Squares or OLS) defined is essentially MSE –
the ½ is just to cancel out the 2 after derivative is taken and is less significant.

It is advisable to start with random θ. Then repeatedly adjust θ to make J(θ) smaller.

You might also like