I've got a trained MatrixFactorizationModel via ALS.train(...) and now I'm
trying to use it to predict some ratings like so:

JavaRDD<Rating> predictions = model.predict(usersProducts.rdd())

Where usersProducts is built from an existing Ratings dataset like so:

JavaPairRDD<Integer,Integer> usersProducts = testRatings.map(
  new PairFunction<Rating, Integer, Integer>() {
    public Tuple2<Integer, Integer> call(Rating r) throws Exception {
      return new Tuple2<Integer, Integer>(r.user(), r.product());
    }
  }
);

The problem is that model.predict(...) doesn't like usersProducts, claiming
that the method doesn't accept an RDD of type Tuple2 however the docs show
the method signature as follows:

def predict(usersProducts: RDD[(Int, Int)]): RDD[Rating]

Am I missing something? The JavaRDD is just a list of Tuple2 elements,
which would match the method signature but the compile is complaining.

Thanks!

Reply via email to