private LongKMeans newLongKMeans(int K) { KMeansConfiguration<LongNearestNeighbours, long[]> newConf = conf.clone(); newConf.setK(K); return new LongKMeans(newConf); } }
/** * Convenience method to quickly create an exact {@link LongKMeans}. 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 LongKMeans} instance configured for exact k-means */ public static LongKMeans createExact(int K) { final KMeansConfiguration<LongNearestNeighbours, long[]> conf = new KMeansConfiguration<LongNearestNeighbours, long[]>(K, new LongNearestNeighboursExact.Factory()); return new LongKMeans(conf); }
/** * Convenience method to quickly create an approximate {@link LongKMeans} * 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 LongKMeans} instance configured for approximate k-means * using an ensemble of KD-Trees */ public static LongKMeans createKDTreeEnsemble(int K) { final KMeansConfiguration<LongNearestNeighbours, long[]> conf = new KMeansConfiguration<LongNearestNeighbours, long[]>(K, new LongNearestNeighboursKDTree.Factory()); return new LongKMeans(conf); }
/** * Convenience method to quickly create an exact {@link LongKMeans}. 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 LongKMeans} instance configured for exact k-means */ public static LongKMeans createExact(int K, int niters) { final KMeansConfiguration<LongNearestNeighbours, long[]> conf = new KMeansConfiguration<LongNearestNeighbours, long[]>(K, new LongNearestNeighboursExact.Factory(), niters); return new LongKMeans(conf); }