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

    https://github.com/apache/spark/pull/12961#discussion_r63009814
  
    --- Diff: python/pyspark/ml/regression.py ---
    @@ -1337,6 +1338,204 @@ def intercept(self):
             """
             return self._call_java("intercept")
     
    +    @property
    +    @since("2.0.0")
    +    def summary(self):
    +        """
    +        Gets summary (e.g. residuals, deviance, pValues) of model on
    +        training set. An exception is thrown if
    +        `trainingSummary is None`.
    +        """
    +        java_lrt_summary = self._call_java("summary")
    +        return GeneralizedLinearRegressionTrainingSummary(java_lrt_summary)
    +
    +    @property
    +    @since("2.0.0")
    +    def hasSummary(self):
    +        """
    +        Indicates whether a training summary exists for this model
    +        instance.
    +        """
    +        return self._call_java("hasSummary")
    +
    +    @since("2.0.0")
    +    def evaluate(self, dataset):
    +        """
    +        Evaluates the model on a test dataset.
    +
    +        :param dataset:
    +          Test dataset to evaluate model on, where dataset is an
    +          instance of :py:class:`pyspark.sql.DataFrame`
    +        """
    +        if not isinstance(dataset, DataFrame):
    +            raise ValueError("dataset must be a DataFrame but got %s." % 
type(dataset))
    +        java_glr_summary = self._call_java("evaluate", dataset)
    +        return GeneralizedLinearRegressionSummary(java_glr_summary)
    +
    +
    +class GeneralizedLinearRegressionSummary(JavaWrapper):
    +    """
    +    .. note:: Experimental
    +
    +    Generalized linear regression results evaluated on a dataset.
    +
    +    .. versionadded:: 2.0.0
    +    """
    +
    +    @property
    +    @since("2.0.0")
    +    def predictions(self):
    +        """
    +        Predictions output by the model's `transform` method.
    +        """
    +        return self._call_java("predictions")
    +
    +    @property
    +    @since("2.0.0")
    +    def predictionCol(self):
    +        """
    +        Field in :py:attr:`predictions` which gives the predicted value of 
each instance.
    +        This is set to a new column name if the original model's 
`predictionCol` is not set.
    +        """
    +        return self._call_java("predictionCol")
    +
    +    @property
    +    @since("2.0.0")
    +    def rank(self):
    +        """
    +        The numeric rank of the fitted linear model.
    +        """
    +        return self._call_java("rank")
    +
    +    @property
    +    @since("2.0.0")
    +    def degreesOfFreedom(self):
    +        """
    +        Degrees of freedom.
    +        """
    +        return self._call_java("degreesOfFreedom")
    +
    +    @property
    +    @since("2.0.0")
    +    def residualDegreeOfFreedom(self):
    +        """
    +        The residual degrees of freedom.
    +        """
    +        return self._call_java("residualDegreeOfFreedom")
    +
    +    @property
    +    @since("2.0.0")
    +    def residualDegreeOfFreedomNull(self):
    +        """
    +        The residual degrees of freedom for the null model.
    +        """
    +        return self._call_java("residualDegreeOfFreedomNull")
    +
    +    @since("2.0.0")
    +    def residuals(self, residualsType="deviance"):
    +        """
    +        Get the residuals of the fitted model by type.
    --- End diff --
    
    Minor: Add doc for default returned residuals (deviance residuals).


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to