Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Exercises

  1. Optimizing the number of neighbors. Create a cost function for optimization that determines the ideal number of neighbors for a simple dataset.

  2. Leave-one-out cross-validation. Leave-one-out cross-validation is an alternative method of calculating prediction error that treats every row in the dataset individually as a test set, and treats the rest of the data as a training set. Implement a function to do this. How does it compare to the method described in this chapter?

  3. Eliminating variables. Rather than trying to optimize variable scales for a large set of variables that are probably useless, you could try to eliminate variables that make the prediction much worse before doing anything else. Can you think of a way to do this?


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint