Skip to content

Commit 31cd96f

Browse files
committed
specify the seed to randomforestregressor test
1 parent e1b947f commit 31cd96f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

python/pyspark/ml/regression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ class RandomForestRegressor(JavaEstimator, HasFeaturesCol, HasLabelCol, HasPredi
254254
>>> df = sqlContext.createDataFrame([
255255
... (1.0, Vectors.dense(1.0)),
256256
... (0.0, Vectors.sparse(1, [], []))], ["label", "features"])
257-
>>> rf = RandomForestRegressor(numTrees=2, maxDepth=2)
257+
>>> rf = RandomForestRegressor(numTrees=2, maxDepth=2, seed=42)
258258
>>> model = rf.fit(df)
259259
>>> test0 = sqlContext.createDataFrame([(Vectors.dense(-1.0),)], ["features"])
260260
>>> model.transform(test0).head().prediction

0 commit comments

Comments
 (0)