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")