Research Article

Moth-Flame Optimization for Early Prediction of Heart Diseases

Algorithm 1

Algorithm of KNN.
Step 1. Decide on the number of neighbours (K).
Step 2. Determine the Euclidean distance between K neighbours.
Step 3. Using the obtained Euclidean distance, find the K closest neighbours.
Step 4. Count the number of data points in each group among these K neighbours.
Step 5. Assign the new data points to the group among with the greatest number neighbours.
Step 6. We have completed our model.