How do I draw a decision boundary?

조회 수: 14 (최근 30일)
Bradley Flynn
Bradley Flynn 2016년 2월 16일
답변: Matthew Eicholtz 2016년 2월 16일
Let's say I have two classes of points where class 1 has points (0, 1), (2, 3), (4, 4) and class 2 has points (2, 0), (5, 2), (6, 3), how would I go about plotting these with a k-nearest-neighbor decision boundary with k=1? I'd also like to use Euclidean distance as my metric.
Thanks!

답변 (1개)

Matthew Eicholtz
Matthew Eicholtz 2016년 2월 16일
For k=1, this amounts to the Voronoi diagram.
x = [0 2 4 2 5 6];
y = [1 3 4 0 2 3];
voronoi(x,y)

카테고리

Help CenterFile Exchange에서 Voronoi Diagram에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by