예제 #1
0
 /**
  * This method applies a kmeans model to a given dataset
  *
  * @param kMeansModel KMeans model
  * @param data JavaRDD containing feature vectors
  * @return JavaRDD containing cluster centers
  */
 public JavaRDD<Integer> test(KMeansModel kMeansModel, JavaRDD<Vector> data) {
   return kMeansModel.predict(data);
 }
예제 #2
0
 public Tuple2<Integer, String> call(Tuple2<String, Vector> args) {
   String title = args._1();
   Vector point = args._2();
   int cluster = model.predict(point);
   return new Tuple2<Integer, String>(cluster, title);
 }