aboutsummaryrefslogtreecommitdiff
path: root/python/pyspark/ml/regression.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/pyspark/ml/regression.py')
-rw-r--r--python/pyspark/ml/regression.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/python/pyspark/ml/regression.py b/python/pyspark/ml/regression.py
index 898260879d..59d4fe3cf4 100644
--- a/python/pyspark/ml/regression.py
+++ b/python/pyspark/ml/regression.py
@@ -641,7 +641,7 @@ class GBTRegressor(JavaEstimator, HasFeaturesCol, HasLabelCol, HasPredictionCol,
>>> df = sqlContext.createDataFrame([
... (1.0, Vectors.dense(1.0)),
... (0.0, Vectors.sparse(1, [], []))], ["label", "features"])
- >>> gbt = GBTRegressor(maxIter=5, maxDepth=2)
+ >>> gbt = GBTRegressor(maxIter=5, maxDepth=2, seed=42)
>>> model = gbt.fit(df)
>>> allclose(model.treeWeights, [1.0, 0.1, 0.1, 0.1, 0.1])
True
@@ -664,18 +664,19 @@ class GBTRegressor(JavaEstimator, HasFeaturesCol, HasLabelCol, HasPredictionCol,
def __init__(self, featuresCol="features", labelCol="label", predictionCol="prediction",
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0,
maxMemoryInMB=256, cacheNodeIds=False, subsamplingRate=1.0,
- checkpointInterval=10, lossType="squared", maxIter=20, stepSize=0.1):
+ checkpointInterval=10, lossType="squared", maxIter=20, stepSize=0.1, seed=None):
"""
__init__(self, featuresCol="features", labelCol="label", predictionCol="prediction", \
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0, \
maxMemoryInMB=256, cacheNodeIds=False, subsamplingRate=1.0, \
- checkpointInterval=10, lossType="squared", maxIter=20, stepSize=0.1)
+ checkpointInterval=10, lossType="squared", maxIter=20, stepSize=0.1, seed=None)
"""
super(GBTRegressor, self).__init__()
self._java_obj = self._new_java_obj("org.apache.spark.ml.regression.GBTRegressor", self.uid)
self._setDefault(maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0,
maxMemoryInMB=256, cacheNodeIds=False, subsamplingRate=1.0,
- checkpointInterval=10, lossType="squared", maxIter=20, stepSize=0.1)
+ checkpointInterval=10, lossType="squared", maxIter=20, stepSize=0.1,
+ seed=None)
kwargs = self.__init__._input_kwargs
self.setParams(**kwargs)
@@ -684,12 +685,12 @@ class GBTRegressor(JavaEstimator, HasFeaturesCol, HasLabelCol, HasPredictionCol,
def setParams(self, featuresCol="features", labelCol="label", predictionCol="prediction",
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0,
maxMemoryInMB=256, cacheNodeIds=False, subsamplingRate=1.0,
- checkpointInterval=10, lossType="squared", maxIter=20, stepSize=0.1):
+ checkpointInterval=10, lossType="squared", maxIter=20, stepSize=0.1, seed=None):
"""
setParams(self, featuresCol="features", labelCol="label", predictionCol="prediction", \
maxDepth=5, maxBins=32, minInstancesPerNode=1, minInfoGain=0.0, \
maxMemoryInMB=256, cacheNodeIds=False, subsamplingRate=1.0, \
- checkpointInterval=10, lossType="squared", maxIter=20, stepSize=0.1)
+ checkpointInterval=10, lossType="squared", maxIter=20, stepSize=0.1, seed=None)
Sets params for Gradient Boosted Tree Regression.
"""
kwargs = self.setParams._input_kwargs