Example usage for org.apache.commons.math.stat.clustering Cluster addPoint

List of usage examples for org.apache.commons.math.stat.clustering Cluster addPoint

Introduction

In this page you can find the example usage for org.apache.commons.math.stat.clustering Cluster addPoint.

Prototype

public void addPoint(final T point) 

Source Link

Document

Add a point to this cluster.

Usage

From source file:org.basketball.MyKMeansPlusPlusClusterer.java

/**
 * Adds the given points to the closest {@link Cluster}.
 *
 * @param <T> type of the points to cluster
 * @param clusters the {@link Cluster}s to add the points to
 * @param points the points to add to the given {@link Cluster}s
 */// ww  w .  ja v  a  2  s. c  om
private static <T extends Clusterable<T>> void assignPointsToClusters(final Collection<Cluster<T>> clusters,
        final Collection<T> points) {
    for (final T p : points) {
        Cluster<T> cluster = getNearestCluster(clusters, p);
        cluster.addPoint(p);
    }
}