Skip to content
This repository was archived by the owner on May 9, 2024. It is now read-only.

Commit 2470004

Browse files
committed
Fix a bunch of seeds with default values to have None as the default which will then result in using the hash of the class name
1 parent cbad96d commit 2470004

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

python/pyspark/ml/classification.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -319,12 +319,12 @@ class RandomForestClassifier(JavaEstimator, HasFeaturesCol, HasLabelCol, HasPred
319319
def __init__(self, featuresCol="features", labelCol="label", predictionCol="prediction",
320320
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0,
321321
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, impurity="gini",
322-
numTrees=20, featureSubsetStrategy="auto", seed=42):
322+
numTrees=20, featureSubsetStrategy="auto", seed=None):
323323
"""
324324
__init__(self, featuresCol="features", labelCol="label", predictionCol="prediction", \
325325
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0, \
326326
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, impurity="gini", \
327-
numTrees=20, featureSubsetStrategy="auto", seed=42)
327+
numTrees=20, featureSubsetStrategy="auto", seed=None)
328328
"""
329329
super(RandomForestClassifier, self).__init__()
330330
self._java_obj = self._new_java_obj(
@@ -347,20 +347,20 @@ def __init__(self, featuresCol="features", labelCol="label", predictionCol="pred
347347
"The number of features to consider for splits at each tree node. Supported " +
348348
"options: " + ", ".join(RandomForestParams.supportedFeatureSubsetStrategies))
349349
self._setDefault(maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0,
350-
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, seed=42,
350+
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, seed=None,
351351
impurity="gini", numTrees=20, featureSubsetStrategy="auto")
352352
kwargs = self.__init__._input_kwargs
353353
self.setParams(**kwargs)
354354

355355
@keyword_only
356356
def setParams(self, featuresCol="features", labelCol="label", predictionCol="prediction",
357357
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0,
358-
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, seed=42,
358+
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, seed=None,
359359
impurity="gini", numTrees=20, featureSubsetStrategy="auto"):
360360
"""
361361
setParams(self, featuresCol="features", labelCol="label", predictionCol="prediction", \
362362
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0, \
363-
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, seed=42, \
363+
maxMemoryInMB=256, cacheNodeIds=False, checkpointInterval=10, seed=None, \
364364
impurity="gini", numTrees=20, featureSubsetStrategy="auto")
365365
Sets params for linear classification.
366366
"""

python/pyspark/ml/recommendation.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ class ALS(JavaEstimator, HasCheckpointInterval, HasMaxIter, HasPredictionCol, Ha
8989

9090
@keyword_only
9191
def __init__(self, rank=10, maxIter=10, regParam=0.1, numUserBlocks=10, numItemBlocks=10,
92-
implicitPrefs=False, alpha=1.0, userCol="user", itemCol="item", seed=0,
92+
implicitPrefs=False, alpha=1.0, userCol="user", itemCol="item", seed=None,
9393
ratingCol="rating", nonnegative=False, checkpointInterval=10):
9494
"""
9595
__init__(self, rank=10, maxIter=10, regParam=0.1, numUserBlocks=10, numItemBlocks=10, \
96-
implicitPrefs=false, alpha=1.0, userCol="user", itemCol="item", seed=0, \
96+
implicitPrefs=false, alpha=1.0, userCol="user", itemCol="item", seed=None, \
9797
ratingCol="rating", nonnegative=false, checkpointInterval=10)
9898
"""
9999
super(ALS, self).__init__()
@@ -109,18 +109,18 @@ def __init__(self, rank=10, maxIter=10, regParam=0.1, numUserBlocks=10, numItemB
109109
self.nonnegative = Param(self, "nonnegative",
110110
"whether to use nonnegative constraint for least squares")
111111
self._setDefault(rank=10, maxIter=10, regParam=0.1, numUserBlocks=10, numItemBlocks=10,
112-
implicitPrefs=False, alpha=1.0, userCol="user", itemCol="item", seed=0,
112+
implicitPrefs=False, alpha=1.0, userCol="user", itemCol="item", seed=None,
113113
ratingCol="rating", nonnegative=False, checkpointInterval=10)
114114
kwargs = self.__init__._input_kwargs
115115
self.setParams(**kwargs)
116116

117117
@keyword_only
118118
def setParams(self, rank=10, maxIter=10, regParam=0.1, numUserBlocks=10, numItemBlocks=10,
119-
implicitPrefs=False, alpha=1.0, userCol="user", itemCol="item", seed=0,
119+
implicitPrefs=False, alpha=1.0, userCol="user", itemCol="item", seed=None,
120120
ratingCol="rating", nonnegative=False, checkpointInterval=10):
121121
"""
122122
setParams(self, rank=10, maxIter=10, regParam=0.1, numUserBlocks=10, numItemBlocks=10, \
123-
implicitPrefs=False, alpha=1.0, userCol="user", itemCol="item", seed=0, \
123+
implicitPrefs=False, alpha=1.0, userCol="user", itemCol="item", seed=None, \
124124
ratingCol="rating", nonnegative=False, checkpointInterval=10)
125125
Sets params for ALS.
126126
"""

0 commit comments

Comments
 (0)