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
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Part 1: Classification > Classifying with k-Nearest Neighbors

2. Classifying with k-Nearest Neighbors

This chapter covers

  • The k-Nearest Neighbors classification algorithm

  • Parsing and importing data from a text file

  • Creating scatter plots with Matplotlib

  • Normalizing numeric values


Have you ever seen movies categorized into genres? What defines these genres, and who says which movie goes into what genre? The movies in one genre are similar but based on what? I’m sure if you asked the people involved with making the movies, they wouldn’t say that their movie is just like someone else’s movie, but in some way you know they’re similar. What makes an action movie similar to another action movie and dissimilar to a romance movie? Do people kiss in action movies, and do people kick in romance movies? Yes, but there’s probably more kissing in romance movies and more kicking in action movies. Perhaps if you measured kisses, kicks, and other things per movie, you could automatically figure out what genre a movie belongs to. I’ll use movies to explain some of the concepts of k-Nearest Neighbors; then we will move on to other applications.


  

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