如何跟踪hadoop ALS的进度?

时间:2018-12-16 15:25:14

标签: hadoop apache-spark-mllib recommendation-engine

我正在使用这段代码来计算推荐:

   SparkSession spark = SparkSession
            .builder()
            .appName("SomeAppName")
            .config("spark.master", "local")
            .getOrCreate();
    JavaRDD<Rating> ratingsRDD = spark
            .read().textFile(args[0]).javaRDD()
            .map(Rating::parseRating);
    Dataset<Row> ratings = spark.createDataFrame(ratingsRDD, Rating.class);
    ALS als = new ALS()
            .setMaxIter(1)
            .setRegParam(0.01)
            .setUserCol("userId")
            .setItemCol("movieId")
            .setRatingCol("rating");
    ALSModel model = als.fit(ratings);
    model.setColdStartStrategy("drop");
    Dataset<Row> rowDataset = model.recommendForAllUsers(50);

我想跟踪迭代的进度,理想情况下可以看到迭代编号,我能以某种方式提供Java回调吗?

0 个答案:

没有答案