-
K-최근접 이웃(KNN: K-Nearest Neighbors)아가개발자/머신러닝 2020. 9. 18. 16:39
KNN (K-Nearest Neighbors)
: 주변 K개의 자료의 class로 분류하는 방식
x의 class를 점선 동그라미 범위 안의 K개의 class 분포를 보고 예측
파란 동그라미 3개, 초록 세모 2개 → x = 파란 동그라미 (투표 방식)
KNN은 게으른 학습(lazy learner), 사례중심 학습(instance-based learning)이라고 불림, 예측 모델을 만들고 파라미터를 추정하는 방식이 아니기 때문
- 가중 합 방식 (Weighted voting)
: 가까운 이웃의 정보에 가중치를 부여
오른쪽 그래프의 x의 예측 class는 파란 동그라미, 왼쪽 그래프의 x의 예측 class는 초록 세모
K값이 바뀌면 예측한 class 값이 달라질 수 있음 → 가중 합 방식 사용
- KNN의 장단점
- 장점
- 학습 데이터 내의 노이즈에 영향을 크게 받지 않음
- 학습 데이터가 많을 때 효과적임
- 데이터의 분산을 고려할 경우 매우 강건함
- 단점
- K와 거리의 척도를 데이터 특성에 맞게 직접 설정해야 함
- 새로운 관측치와 학습 데이터 사이의 거리를 전부 측정해야 하므로 계산 시간이 오래 걸림
'아가개발자 > 머신러닝' 카테고리의 다른 글
로지스틱 회귀-Logistic regression (0) 2020.09.28 다중선형회귀 - Multiple Linear Regression (0) 2020.09.28 KNN classification - iris (0) 2020.09.18 데이터 전처리와 최적화2 - 데이터 변환/데이터 정제/데이터 통합/데이터 불균형 (0) 2020.09.15 데이터 전처리와 최적화 - 데이터 실수화 (Data Vectorization) (0) 2020.09.15