Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Machine Learning Algorithms

You're reading from   Mastering Machine Learning Algorithms Expert techniques for implementing popular machine learning algorithms, fine-tuning your models, and understanding how they work

Arrow left icon
Product type Paperback
Published in Jan 2020
Publisher Packt
ISBN-13 9781838820299
Length 798 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Giuseppe Bonaccorso Giuseppe Bonaccorso
Author Profile Icon Giuseppe Bonaccorso
Giuseppe Bonaccorso
Giuseppe Bonaccorso Giuseppe Bonaccorso
Author Profile Icon Giuseppe Bonaccorso
Giuseppe Bonaccorso
Arrow right icon
View More author details
Toc

Table of Contents (28) Chapters Close

Preface 1. Machine Learning Model Fundamentals 2. Loss Functions and Regularization FREE CHAPTER 3. Introduction to Semi-Supervised Learning 4. Advanced Semi-Supervised Classification 5. Graph-Based Semi-Supervised Learning 6. Clustering and Unsupervised Models 7. Advanced Clustering and Unsupervised Models 8. Clustering and Unsupervised Models for Marketing 9. Generalized Linear Models and Regression 10. Introduction to Time-Series Analysis 11. Bayesian Networks and Hidden Markov Models 12. The EM Algorithm 13. Component Analysis and Dimensionality Reduction 14. Hebbian Learning 15. Fundamentals of Ensemble Learning 16. Advanced Boosting Algorithms 17. Modeling Neural Networks 18. Optimizing Neural Networks 19. Deep Convolutional Networks 20. Recurrent Neural Networks 21. Autoencoders 22. Introduction to Generative Adversarial Networks 23. Deep Belief Networks 24. Introduction to Reinforcement Learning 25. Advanced Policy Estimation Algorithms 26. Other Books You May Enjoy
27. Index

K-nearest neighbors

This algorithm belongs to a particular family called instance-based algorithms (the methodology is called instance-based learning).

It differs from other approaches because it doesn't work with an actual mathematical model. On the contrary, the inference is performed by direct comparison of new samples with existing ones (which are defined as instances). KNN is an approach that can be easily employed to solve clustering, classification, and regression problems (even though, in this case, we are going to consider only the first technique). The main idea behind the clustering algorithm is very simple. Let's consider a data generating process pdata and finite a dataset drawn from this distribution:

Each point has a dimensionality equal to N. We can now introduce a distance function , which in most cases can be generalized with the Minkowski distance:

When p = 2, represents the classical Euclidean distance, that is normally the ...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime