Question: Exercise 2 : Models for Data ( 2 5 points ) y x A model is a function that takes an input and produces a
Exercise : Models for Data points
A model is a function that takes an input and produces a prediction
Let's consider two possible models for this data:
Compute the predictions of models and for the values in These predictions should be vectors
of the same shape as Then plot the prediction lines of these two models overlayed on the "observed" data Use pltplot to draw the lines. Note: you will generate only one plot. Make sure to include axes, titles and legend.
Evaluation Metrics
How good are our models? Intuitively, the better the model, the more closely it fits the data we have.
That is for each we'll compare the true value, with the predicted value. This comparison is often
called the loss or the error. One common such comparison is squared error: Averaging over all our data points, we get the mean squared error.
MSE hat
Exercise : Computing MSE points
Write a function for computing the MSE metric and use it to compute the MSE for the two models above, and
def MSEtruevalues, predictedvalues:
Return the MSE between truevalues and predicted values.""."
# YOUR CODE HERE
print MSE for M: MSEY M
print MSE for M: MSEY M
MSE fo
r M:
None
MSE fo
M:
None
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
