private DoubleKMeans newDoubleKMeans(int K) { KMeansConfiguration<DoubleNearestNeighbours, double[]> newConf = conf.clone(); newConf.setK(K); return new DoubleKMeans(newConf); } }
/** * Convenience method to quickly create an exact {@link DoubleKMeans}. 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 exact k-means */ public static DoubleKMeans createExact(int K) { final KMeansConfiguration<DoubleNearestNeighbours, double[]> conf = new KMeansConfiguration<DoubleNearestNeighbours, double[]>(K, new DoubleNearestNeighboursExact.Factory()); return new DoubleKMeans(conf); }
/** * 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); }
/** * Convenience method to quickly create an exact {@link DoubleKMeans}. All * parameters other than the number of clusters and number * of iterations 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 * @param niters * maximum number of iterations * @return a {@link DoubleKMeans} instance configured for exact k-means */ public static DoubleKMeans createExact(int K, int niters) { final KMeansConfiguration<DoubleNearestNeighbours, double[]> conf = new KMeansConfiguration<DoubleNearestNeighbours, double[]>(K, new DoubleNearestNeighboursExact.Factory(), niters); return new DoubleKMeans(conf); }