Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Machine Learning with Python

You're reading from  Machine Learning with Python

Product type Book
Published in Mar 2024
Publisher Packt
ISBN-13 9781835461969
Pages 146 pages
Edition 1st Edition
Languages
Author (1):
Oliver Theobald Oliver Theobald
Profile icon Oliver Theobald

Table of Contents (18) Chapters

FOREWORD
DATASETS USED IN THIS BOOK
INTRODUCTION
DEVELOPMENT ENVIRONMENT
MACHINE LEARNING LIBRARIES
EXPLORATORY DATA ANALYSIS
DATA SCRUBBING
PRE-MODEL ALGORITHMS
SPLIT VALIDATION
MODEL DESIGN
LINEAR REGRESSION
LOGISTIC REGRESSION
SUPPORT VECTOR MACHINES
k-NEAREST NEIGHBORS
TREE-BASED METHODS
NEXT STEPS
APPENDIX 1: INTRODUCTION TO PYTHON
APPENDIX 2: PRINT COLUMNS

k-NEAREST NEIGHBORS

 

Our next supervised learning classification technique is k-nearest neighbors, which classifies new unknown data points based on their proximity to known data points. This process of classification is determined by setting “k” number of data points closest to the target data point. If we set k to 3, for example, k-NN analyzes the nearest three data points (neighbors) to the target data point.

 

 

A diagram of a class  Description automatically generated

Figure 29: An example of k-NN clustering used to predict the class of a new data point

 

The k-nearest neighbors technique is sometimes referred to as a “memory-based procedure” because the full training data is used each time a prediction is made.18 For this reason, k-NN is generally not recommended for analyzing large datasets and measuring multiple distances in high-dimensional data. Reducing the number of dimensions, through the use of a descending dimension algorithm such as principal component analysis (PCA) or...

lock icon The rest of the chapter is locked
You have been reading a chapter from
Machine Learning with Python
Published in: Mar 2024 Publisher: Packt ISBN-13: 9781835461969
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 $15.99/month. Cancel anytime}