Research Article

Keratoconus Severity Classification Using Features Selection and Machine Learning Algorithms

Algorithm 2

KNN algorithm.
Input data:
   i. Dataset D.
   ii. A distance calculation function.
   iii. A number K
To predict a new observation X, do:
1. Calculate all distances of this observation with the other observations in the dataset D.
2. Retain the K observations from the dataset close to X using the selected distance calculation function.
3. Take the values of retained observations:
   a. if regression: Calculate the average of retained observations values.
   b. if classification: Calculate the mode of retained observations values.
4. Return the value calculated in step 3 as a predicted value by K-NN for the observation X.