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

[ENH] Implement GaussianRegressor using scikit-learn's LinearRegression adapter #216

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

sanjayk0508
Copy link

@sanjayk0508 sanjayk0508 commented Mar 23, 2024

towards #7

This PR introduces Gaussian regression implementation using scikit-learn's LinearRegression, fulfilling the basic capabilities of Gaussian regression within the skpro.

Key Changes

  • Implemented the GaussianRegressor class, which adapts scikit-learn's LinearRegression for Gaussian regression.
  • Added methods for model fitting, prediction, model evaluation, parameter handling, and testing support.
  • Aligns with existing skpro architecture and conventions.
  • Comprehensive documentation

Additional Notes

  • Tested with pytest for the implementation to ensure correctness and reliability.

I think there's still potential for more enhancements, this PR sets the groundwork for GaussianRegressor. Open to feedback and suggestions for further refinement and iteration.

Signed-off-by: Sanjay <[email protected]>
Signed-off-by: Sanjay <[email protected]>
Signed-off-by: Sanjay <[email protected]>
Signed-off-by: Sanjay <[email protected]>
Copy link
Collaborator

@fkiraly fkiraly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

This could in-principle be a useful addition, but it does not comply with the extension template, see regression.py.

In particular, you should:

  • not override predict and predict_proba. Implement _predict and _predict_proba.
  • _predict_proba should return a probability distribution object, an skpro BaseDistribution.
  • predict should not write any attributes to self.
  • I think you can't use _DelegateWithFittedParamForwarding, because LinearRegression.predict does not have a return_std argument

I would recommend to start with the extension template, not with the sklearn adapter template. That is, extension_templates/regression.py.

How about you look at statmodels GLM instead, with a Gaussian link?
https://www.statsmodels.org/stable/glm.html#module-statsmodels.genmod.generalized_linear_model

@fkiraly fkiraly added enhancement module:regression probabilistic regression module labels Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement module:regression probabilistic regression module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants