Visualizing kNN distance score
The kNN distance score can be hard to interpret by simply eyeballing a set of values. It's helpful to use scatterplots to visualize the kNN distance score to understand how the score works. When interpreting the plot, the relative size of the kNN distance score is more informative than the absolute value.
The wine data has been loaded with the kNN distance score appended from the previous exercise.
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
Introduction to Anomaly Detection in R
คำแนะนำการฝึกหัด
- Use a scatterplot to show
pHandalcoholon their original scales. - Supply an appropriate value to the
cexargument so that each point is proportional in size to the square root of thescore. - Adjust the plotting character argument
pchso that points are shown as solid bullets.
แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ
ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์
# Scatterplot showing pH, alcohol and kNN score
plot(pH ~ alcohol, ___, cex = ___, pch = ___)