Skip to content
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

Improvement Suggestion for predictor_proba Function in sklearn.py #1312

Open
HJH0924 opened this issue Feb 6, 2024 · 1 comment
Open

Improvement Suggestion for predictor_proba Function in sklearn.py #1312

HJH0924 opened this issue Feb 6, 2024 · 1 comment

Comments

@HJH0924
Copy link

HJH0924 commented Feb 6, 2024

Hello,

I've been exploring the predictor_proba function defined in sklearn.py at this location and I have some suggestions to improve its functionality and usability.

  1. Clarify the Function's Docstring: The current docstring mentions a parameter num_targets which is not present in the function signature. It might be beneficial for future users if the documentation accurately reflects the function's parameters and intended use.
  2. Handling Multi-class Predictions: For models that predict probabilities across multiple classes, flattening the output might not always be desirable. It could be more useful to return the original array structure to preserve the relationship between classes and probabilities.
  3. Error Handling for predict_proba Method: Not all Scikit-Learn estimators have a predict_proba method. Adding a check to ensure that the estimator passed to predictor_proba supports this method could prevent runtime errors and improve user experience.
@montanalow
Copy link
Contributor

  1. & 3) are no brainers IMOs, thanks for pointing out those improvements. PRs welcome.

  2. is an interesting point. There are a few considerations around return types needing to be the same for Postgres functions with the same name, but we are starting to accumulate function variants for features like this. It might be worth it to add pgml.predict_proba_multi or some other appropriately named function to provide an more appropriately structured return type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants