spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mengxr <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-10688][ML][PySpark] Python API for AFTS...
Date Tue, 29 Sep 2015 05:34:12 GMT
Github user mengxr commented on a diff in the pull request:

    https://github.com/apache/spark/pull/8926#discussion_r40636011
  
    --- 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],
    --- End diff --
    
    Please keep the default array here instead of `None` because this only affects the doc.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


Mime
View raw message