Week 9 PDF
Week 9 PDF
LEARNING IN PYTHON
• Least-squares linear regression finds the line through this cloud of points that
minimizes what is called the means squared error of the model.
• The mean squared error of the model is essentially the sum of the squared
differences between the predicted target value and the actual target value for
all the points in the training set.
APPLIED MACHINE
LEARNING IN PYTHON
• One thing to note about this linear regression model is that there are no
parameters to control the model complexity.
• No matter what the value of w and b, the result is always going to be a straight
line.
• This is both a strength and a weakness of the model as we'll see later.
APPLIED MACHINE
LEARNING IN PYTHON
• You can see that linear models make a strong prior assumption about the relationship
between the input x and output y.
• Linear models may seem simplistic, but for data with many features linear models can be
very effective and generalize well to new data beyond the training set.
• Now the question is, how exactly do we estimate the linear models w and b parameters
so the model is a good fit?
APPLIED MACHINE
LEARNING IN PYTHON
• For linear models, model complexity is based on the nature of the weights w
on the input features.
• The prediction is incorrect when the predicted target value is different than
the actual target value in the training set.
• Least-squares finds the values of w and b that minimize the total sum of
squared differences between the predicted y value and the actual y value in
the training set.
linreg.coef linreg.intercept
_ _
APPLIED MACHINE
LEARNING IN PYTHON
linreg.coef linreg.intercept
_ _
APPLIED MACHINE
LEARNING IN PYTHON
linreg.coef linreg.intercept
_ _
APPLIED MACHINE
LEARNING IN PYTHON