Github user holdenk commented on a diff in the pull request:
https://github.com/apache/spark/pull/15777#discussion_r86676679
--- Diff: python/pyspark/ml/classification.py ---
@@ -309,13 +309,16 @@ def interceptVector(self):
@since("2.0.0")
def summary(self):
"""
- Gets summary (e.g. residuals, mse, r-squared ) of model on
- training set. An exception is thrown if
- `trainingSummary is None`.
+ Gets summary (e.g. accuracy/precision/recall, objective history,
total iterations) of model
+ trained on the training set. An exception is thrown if
`trainingSummary is None`.
"""
- java_blrt_summary = self._call_java("summary")
- # Note: Once multiclass is added, update this to return correct
summary
- return BinaryLogisticRegressionTrainingSummary(java_blrt_summary)
+ if self.hasSummary:
+ java_blrt_summary = self._call_java("summary")
+ # Note: Once multiclass is added, update this to return
correct summary
+ return
BinaryLogisticRegressionTrainingSummary(java_blrt_summary)
+ else:
+ raise RuntimeError("No training summary available for this %s"
%
--- End diff --
I think thats generally a good improvement, the `Py4J` errors are often
confusing to end users.
---
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]