// (C) 2015 Frank Nielsen, tested using Processing.org v 2.2.1 // "Introduction to HPC with MPI for Data Science", Springer UTiCS, 2016 // Program that displays the decision boundary of the nearest neighbor classification rule // Use keys 'c', 's', 'i', 'd', 'q', 'v', 'r', 'l', 'b', ' ' int ww=512; int hh=ww; int delta=1; static int nmax=100; float[][] class1=new float [100][2]; float[][] class2=new float[nmax][2]; float ws=10; int pale=255; int n1, n2; boolean showLegend=true; boolean showBorder=true; boolean showCursor=true; boolean showBoundary=true; PImage vor = createImage(ww, hh, RGB); PImage voronoicell = createImage(ww, hh, RGB); int argdist1(int i, int j) { int l; int winner=-1; float dd=1.0e8; for (l=0; l0) { if (showBoundary) image(vor, 0, 0); else { image(voronoicell, 0, 0); } } stroke(0); fill(255, 0, 0); for (i=0; i