-
Notifications
You must be signed in to change notification settings - Fork 855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add predictor.predict_multi and predictor.predict_proba_multi #2727
Conversation
Job PR-2727-bd4488f is done. |
Shall we just extend |
That is possible, but it would add a significant amount of complexity to the doc of In general most users wouldn't need to use |
Another thought: A different name could be |
# Using > instead of >= to align with Pandas `.idxmax` logic which picks the left-most column during ties. | ||
# If this is not done, then predictions can be inconsistent when converting in binary classification from multiclass-form pred_proba and | ||
# binary-form pred_proba when the pred_proba is 0.5 for positive and negative classes. | ||
y_pred = [1 if pred > 0.5 else 0 for pred in y_pred_proba] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we move 0.5
into a property or method method call? Rationale: at some point we'll add optimization of the threshold so having either method or named property would be a natural place to change instead of looking for magic value here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but this should be a separate PR as it is a major change. I've had this in mind for awhile
@@ -1491,7 +1491,7 @@ def evaluate_predictions(self, y_true, y_pred, sample_weight=None, silent=False, | |||
return self._learner.evaluate_predictions(y_true=y_true, y_pred=y_pred, sample_weight=sample_weight, silent=silent, | |||
auxiliary_metrics=auxiliary_metrics, detailed_report=detailed_report) | |||
|
|||
def leaderboard(self, data=None, extra_info=False, extra_metrics=None, only_pareto_frontier=False, skip_score=False, silent=False): | |||
def leaderboard(self, data=None, extra_info=False, extra_metrics=None, only_pareto_frontier=False, skip_score=False, silent=False) -> pd.DataFrame: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add parameter types too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added, note type hint for data will wait for future PR due to multiple types support
transform_features=transform_features, | ||
inverse_transform=inverse_transform) | ||
|
||
def predict_dict(self, data=None, models=None, as_pandas=True, transform_features=True, inverse_transform=True) -> dict: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: ... -> Dict[str, DataFrame]
+ add parameter types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added, note type hint for data and output will wait for future PR due to multiple types support
X: pd.DataFrame, | ||
models: List[str], | ||
record_pred_time: bool = False, | ||
**kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add return type hint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will wait for future PR, the return type is not trivial as it can be a tuple
bd4488f
to
0caa888
Compare
Job PR-2727-0caa888 is done. |
Note: renamed to |
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.