LFD Book Forum REQUEST: Q7 How-To
 User Name Remember Me? Password
 FAQ Calendar Mark Forums Read

 Thread Tools Display Modes
#1
01-27-2016, 10:50 PM
 galo Junior Member Join Date: Jan 2016 Posts: 7
REQUEST: Q7 How-To

Can anybody share the rundown to get the answer? I can't grasp a way to do it. Plus it gets frustrating because I feel like it's more of an algebra problem rather than a Machine Learning one.
#2
08-14-2016, 02:56 PM
 tddevlin Junior Member Join Date: Feb 2016 Posts: 1
Re: REQUEST: Q7 How-To

**Spoiler Alert: This post contains the full solution**

First let's make sure we have the right picture.

So and are sitting on the -axis, while is somewhere to the right of the -axis at height 1. For this dataset, leave-one-out validation entails fitting our model to two of the points, then testing the fit on the third. Let's start with the constant model, . When we fit this model on two data points, will simply be the average of the -coordinates of the two points.
• Leaving out, we find . The error is .
• Leaving out, we also find . Again, .
• Finally, leaving out, . The error is .

The overall cross-validation error is the average of the three individual errors, , as you can verify. Looking ahead, we would like to find the value of that makes .

Let's turn to the linear model, . The easy case is when is left out. The resulting fitted line is simply and the error is .

Things get more complicated when is left out. We need to find the equation of the line through and . Using slope-intercept form and rearranging, you can check that the fitted line has slope equal to its intercept, . The error on is .

A similar derivation yields .

Putting it all together gives us . If we set this equal to 1/2 (the error from the constant model), we have a quadratic equation in one unknown, which we can solve using the quadratic formula (alternatively, dumping the whole equation into WolframAlpha gives you the roots directly).

Hope that helped!

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home General     General Discussion of Machine Learning     Free Additional Material         Dynamic e-Chapters         Dynamic e-Appendices Course Discussions     Online LFD course         General comments on the course         Homework 1         Homework 2         Homework 3         Homework 4         Homework 5         Homework 6         Homework 7         Homework 8         The Final         Create New Homework Problems Book Feedback - Learning From Data     General comments on the book     Chapter 1 - The Learning Problem     Chapter 2 - Training versus Testing     Chapter 3 - The Linear Model     Chapter 4 - Overfitting     Chapter 5 - Three Learning Principles     e-Chapter 6 - Similarity Based Methods     e-Chapter 7 - Neural Networks     e-Chapter 8 - Support Vector Machines     e-Chapter 9 - Learning Aides     Appendix and Notation     e-Appendices

All times are GMT -7. The time now is 04:37 PM.

 Contact Us - LFD Book - Top

Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
The contents of this forum are to be used ONLY by readers of the Learning From Data book by Yaser S. Abu-Mostafa, Malik Magdon-Ismail, and Hsuan-Tien Lin, and participants in the Learning From Data MOOC by Yaser S. Abu-Mostafa. No part of these contents is to be communicated or made accessible to ANY other person or entity.