Github user mengxr commented on a diff in the pull request:

    https://github.com/apache/spark/pull/8926#discussion_r40636077
  
    --- Diff: python/pyspark/ml/regression.py ---
    @@ -608,6 +609,141 @@ class GBTRegressionModel(TreeEnsembleModels):
         .. versionadded:: 1.4.0
         """
     
    +@inherit_doc
    +class AFTSurvivalRegression(JavaEstimator, HasFeaturesCol, HasLabelCol, 
HasPredictionCol,
    +                            HasFitIntercept, HasMaxIter, HasTol):
    +    """
    +    `https://en.wikipedia.org/wiki/Accelerated_failure_time_model`
    +    Fit a parametric survival regression model named accelerated failure 
time (AFT) model
    +    based on the Weibull distribution of the survival time.
    +
    +    >>> from pyspark.mllib.linalg import Vectors
    +    >>> df = sqlContext.createDataFrame([
    +    ...     (1.0, Vectors.dense(1.0), 1.0),
    +    ...     (0.0, Vectors.sparse(1, [], []), 0.0)], ["label", "features", 
"censor"])
    +    >>> aftsr = AFTSurvivalRegression()
    +    >>> model = aftsr.fit(df)
    +    >>> model.transform(df).show()
    +    +-----+---------+------+----------+
    +    |label| features|censor|prediction|
    +    +-----+---------+------+----------+
    +    |  1.0|    [1.0]|   1.0|       1.0|
    +    |  0.0|(1,[],[])|   0.0|       1.0|
    +    +-----+---------+------+----------+
    +    ...
    +
    +    .. versionadded:: 1.6.0
    +    """
    +
    +    # a placeholder to make it appear in the generated doc
    +    censorCol = Param(Params._dummy(), "censorCol",
    +                      "censor column name")
    +    quantileProbabilities = \
    +        Param(Params._dummy(), "quantileProbabilities",
    +              "quantile probabilities array" +
    +              ", array is not empty and every probability is in range 
[0,1]")
    +    quantilesCol = Param(Params._dummy(), "quantilesCol",
    +                         "quantiles column name")
    +
    +    @keyword_only
    +    def __init__(self, featuresCol="features", labelCol="label", 
predictionCol="prediction",
    +                 fitIntercept=True, maxIter=100, tol=1E-6, 
censorCol="censor",
    +                 quantileProbabilities=[0.01, 0.05, 0.1, 0.25, 0.5, 0.75, 
0.9, 0.95, 0.99],
    +                 quantilesCol=None):
    +        """
    +        __init__(self, featuresCol="features", labelCol="label", 
predictionCol="prediction",
    +                 fitIntercept=True, maxIter=100, tol=1E-6, 
censorCol="censor",
    +                 quantileProbabilities=[0.01, 0.05, 0.1, 0.25, 0.5, 0.75, 
0.9, 0.95, 0.99],
    +                 quantilesCol=None):
    +        """
    +        super(AFTSurvivalRegression, self).__init__()
    +        self._java_obj = self._new_java_obj(
    +            "org.apache.spark.ml.regression.AFTSurvivalRegression", 
self.uid)
    +        self.censorCol = \
    +            Param(self,  "censorCol",
    +                  "censor column name")
    +        self.quantileProbabilities = \
    +            Param(self, "quantileProbabilities",
    +                  "quantile probabilities array" +
    +                  ", array is not empty and every probability is in range 
[0,1]")
    +        self.quantilesCol = Param(self, "quantilesCol",
    +                                  "quantiles column name")
    +        self._setDefault(censorCol="censor",
    +                         quantileProbabilities=[0.01, 0.05, 0.1, 0.25, 
0.5, 0.75, 0.9, 0.95, 0.99])
    +        kwargs = self.__init__._input_kwargs
    +        self.setParams(**kwargs)
    +
    +    @keyword_only
    +    @since("1.6.0")
    +    def setParams(self, featuresCol="features", labelCol="label", 
predictionCol="prediction",
    +                 fitIntercept=True, maxIter=100, tol=1E-6, 
censorCol="censor",
    +                 quantileProbabilities=[0.01, 0.05, 0.1, 0.25, 0.5, 0.75, 
0.9, 0.95, 0.99],
    +                 quantilesCol=None):
    +        """
    +        setParams(self, featuresCol="features", labelCol="label", 
predictionCol="prediction",
    --- End diff --
    
    Same about `\` at the end and the issue with mutable default value.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to