From ea25033744bef26bbe18cf5674ff01c3d4e8048d Mon Sep 17 00:00:00 2001 From: GuoQiang Li Date: Wed, 30 Jul 2014 13:09:24 +0800 Subject: [PATCH] checkpoint products 3,6,9 ... --- .../scala/org/apache/spark/mllib/recommendation/ALS.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mllib/src/main/scala/org/apache/spark/mllib/recommendation/ALS.scala b/mllib/src/main/scala/org/apache/spark/mllib/recommendation/ALS.scala index 6ab429050cf26..d208cfb917f3d 100644 --- a/mllib/src/main/scala/org/apache/spark/mllib/recommendation/ALS.scala +++ b/mllib/src/main/scala/org/apache/spark/mllib/recommendation/ALS.scala @@ -255,7 +255,7 @@ class ALS private ( rank, lambda, alpha, YtY) previousProducts.unpersist() logInfo("Re-computing U given I (Iteration %d/%d)".format(iter, iterations)) - if (sc.checkpointDir.isDefined && (iter % 3 == 1)) { + if (sc.checkpointDir.isDefined && (iter % 3 == 0)) { products.checkpoint() } products.setName(s"products-$iter").persist() @@ -271,7 +271,7 @@ class ALS private ( logInfo("Re-computing I given U (Iteration %d/%d)".format(iter, iterations)) products = updateFeatures(numProductBlocks, users, userOutLinks, productInLinks, rank, lambda, alpha, YtY = None) - if (sc.checkpointDir.isDefined && (iter % 3 == 1)) { + if (sc.checkpointDir.isDefined && (iter % 3 == 0)) { products.checkpoint() } products.setName(s"products-$iter")