/** * Convenience method to quickly create an approximate {@link DoubleKMeans} * using an ensemble of KD-Trees to perform nearest-neighbour lookup. All * parameters other than the number of clusters are set * at their defaults, but can be manipulated through the configuration * returned by {@link #getConfiguration()}. * <p> * Euclidean distance is used to measure the distance between points. * * @param K * the number of clusters * @return a {@link DoubleKMeans} instance configured for approximate k-means * using an ensemble of KD-Trees */ public static DoubleKMeans createKDTreeEnsemble(int K) { final KMeansConfiguration<DoubleNearestNeighbours, double[]> conf = new KMeansConfiguration<DoubleNearestNeighbours, double[]>(K, new DoubleNearestNeighboursKDTree.Factory()); return new DoubleKMeans(conf); }