/** * * @param point * @return */ public double getDistanceFromNearestCluster(Point point) { return nearestCluster(point).getValue(); }
/** * * @param point * @param moveClusterCenter * @return */ public PointClassification classifyPoint(Point point, boolean moveClusterCenter) { Pair<Cluster, Double> nearestCluster = nearestCluster(point); Cluster newCluster = nearestCluster.getKey(); boolean locationChange = isPointLocationChange(point, newCluster); addPointToCluster(point, newCluster, moveClusterCenter); return new PointClassification(nearestCluster.getKey(), nearestCluster.getValue(), locationChange); }