Appending the kNN score
Now you've standardized your input features, it's time to create the kNN distance score for the standardized wine data and append it as a new column.
In this exercise, the 5 nearest neighbor distance score is already available in the object wine_nnd. So that the score is easily available for visualization or further analysis, you'll append the score as a new column to the unstandardized data.
यह अभ्यास पाठ्यक्रम का हिस्सा है
Introduction to Anomaly Detection in R
अभ्यास निर्देश
- Add the 5-nearest neighbor score to the
winedataframe as a new column calledscore.
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# Print the 5-nearest neighbor distance score
wine_nnd[1:5]
# Append the score as a new column