[PYTHON] DeepRunning ~ Level4.5 ~

Level4. Machine learning course (theory and practice)

alt What is a deep learning course that can be crushed in the field in 3 months

4-5. k-nearest neighbor method (kNN)

4-5-1. What is the k-nearest neighbor method (kNN)?

● A machine learning method for classification problems. Get $ k $ of nearest neighbor data and identify it to the class to which it belongs most.

When you decide $ k = 3 $, select the 3 closest data from some data. Among them, identify as belonging to many of the same class that can be classified.

(Example) Of the three data closest to a certain data If two red dots and one blue dot are selected, you are in the red dot class.

● $ k $ needs to be decided before turning the algorithm. ● Increasing $ k $ makes the decision boundary smoother.

4-5-2. Hands-on

● Classify population data.

k近傍法0001.png k近傍法0002.png k近傍法0003.png k近傍法0004.png

I tried it with $ k = 5 $. k近傍法0006.png

I tried it with $ k = 10 $. k近傍法0007.png

4-5-3. Consideration

Is it better to set the value of $ k $ after checking the distribution status of the data? I will study whether there is a way to determine the initial value to this extent. It was a part of my knowledge, so I tried to move it and learned.

Recommended Posts

DeepRunning ~ Level4.4.2 ~
DeepRunning ~ Level 4.6 ~
DeepRunning ~ Level4.3.1 ~
DeepRunning ~ Level3.3 ~
DeepRunning ~ Level7 ~
DeepRunning ~ Level4.5 ~
DeepRunning ~ Level2, Level3.1 ~
DeepRunning ~ Level4.4.1 ~
DeepRunning ~ Level 1 ~
DeepRunning ~ Level 4.7 ~
DeepRunning ~ Level5 ~