Machine Learning Assignment 2
Machine Learning Assignment 2
AHSAN RABBANI
Assistant Professor
Department of Civil Engineering
Darbhanga College of Engineering, Darbhanga, Bihar
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.
This decreases the difference between observed output [h(x)] and desired output [y].
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.