Skip to content

Commit 0bd66b1

Browse files
committed
fixed seed
1 parent 7f6d964 commit 0bd66b1

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

mllib/src/main/scala/org/apache/spark/ml/recommendation/ALS.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ private[recommendation] trait ALSParams extends Params with HasMaxIter with HasR
147147

148148
setDefault(rank -> 10, maxIter -> 10, regParam -> 0.1, numUserBlocks -> 10, numItemBlocks -> 10,
149149
implicitPrefs -> false, alpha -> 1.0, userCol -> "user", itemCol -> "item",
150-
ratingCol -> "rating", nonnegative -> false, checkpointInterval -> 10, seed -> 42L)
150+
ratingCol -> "rating", nonnegative -> false, checkpointInterval -> 10, seed -> 0L)
151151

152152
/**
153153
* Validates and transforms the input schema.

python/pyspark/ml/recommendation.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ class ALS(JavaEstimator, HasCheckpointInterval, HasMaxIter, HasPredictionCol, Ha
8080

8181
@keyword_only
8282
def __init__(self, rank=10, maxIter=10, regParam=0.1, numUserBlocks=10, numItemBlocks=10,
83-
implicitPrefs=False, alpha=1.0, userCol="user", itemCol="item", seed=42L,
83+
implicitPrefs=False, alpha=1.0, userCol="user", itemCol="item", seed=0,
8484
ratingCol="rating", nonnegative=False, checkpointInterval=10):
8585
"""
8686
__init__(self, rank=10, maxIter=10, regParam=0.1, numUserBlocks=10, numItemBlocks=10,
87-
implicitPrefs=false, alpha=1.0, userCol="user", itemCol="item", seed=42L,
87+
implicitPrefs=false, alpha=1.0, userCol="user", itemCol="item", seed=0,
8888
ratingCol="rating", nonnegative=false, checkpointInterval=10)
8989
"""
9090
super(ALS, self).__init__()
@@ -99,18 +99,18 @@ def __init__(self, rank=10, maxIter=10, regParam=0.1, numUserBlocks=10, numItemB
9999
self.nonnegative = Param(self, "nonnegative",
100100
"whether to use nonnegative constraint for least squares")
101101
self._setDefault(rank=10, maxIter=10, regParam=0.1, numUserBlocks=10, numItemBlocks=10,
102-
implicitPrefs=False, alpha=1.0, userCol="user", itemCol="item", seed=42,
102+
implicitPrefs=False, alpha=1.0, userCol="user", itemCol="item", seed=0,
103103
ratingCol="rating", nonnegative=False, checkpointInterval=10)
104104
kwargs = self.__init__._input_kwargs
105105
self.setParams(**kwargs)
106106

107107
@keyword_only
108108
def setParams(self, rank=10, maxIter=10, regParam=0.1, numUserBlocks=10, numItemBlocks=10,
109-
implicitPrefs=False, alpha=1.0, userCol="user", itemCol="item", seed=42,
109+
implicitPrefs=False, alpha=1.0, userCol="user", itemCol="item", seed=0,
110110
ratingCol="rating", nonnegative=False, checkpointInterval=10):
111111
"""
112112
setParams(self, rank=10, maxIter=10, regParam=0.1, numUserBlocks=10, numItemBlocks=10,
113-
implicitPrefs=False, alpha=1.0, userCol="user", itemCol="item", seed=42,
113+
implicitPrefs=False, alpha=1.0, userCol="user", itemCol="item", seed=0,
114114
ratingCol="rating", nonnegative=False, checkpointInterval=10)
115115
Sets params for ALS.
116116
"""
@@ -166,7 +166,6 @@ def setNumBlocks(self, value):
166166
self.paramMap[self.numUserBlocks] = value
167167
self.paramMap[self.numItemBlocks] = value
168168

169-
170169
def setImplicitPrefs(self, value):
171170
"""
172171
Sets the value of :py:attr:`implicitPrefs`.
@@ -264,7 +263,7 @@ class ALSModel(JavaModel):
264263
globs['sc'] = sc
265264
globs['sqlContext'] = sqlContext
266265
globs['df'] = sqlContext.createDataFrame([(0, 0, 4.0), (0, 1, 2.0), (1, 1, 3.0), (1, 2, 4.0),
267-
(2, 1, 1.0), (2, 2, 5.0)], ["user", "item", "rating"])
266+
(2, 1, 1.0), (2, 2, 5.0)], ["user", "item", "rating"])
268267
(failure_count, test_count) = doctest.testmod(globs=globs, optionflags=doctest.ELLIPSIS)
269268
sc.stop()
270269
if failure_count:

0 commit comments

Comments
 (0)