Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started