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
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update - doctest
Signed-off-by: Sanjay <[email protected]>
  • Loading branch information
sanjayk0508 committed Mar 23, 2024
commit 017e1ab17a89ee07038bf40c46c0e38dc15b850d
3 changes: 2 additions & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@
"avatar_url": "https://avatars.githubusercontent.com/u/102804548?v=4",
"profile": "https://github.com/sanjayk0508",
"contributions": [
"code"
"code",
"doc"
]
},
{
Expand Down
Binary file added .coverage.DESKTOP-K5VAFFS.4248.XShvyGBx
Binary file not shown.
Binary file added .coverage.DESKTOP-K5VAFFS.9952.XaELDYfx
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion skpro/regression/gr/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Gaussian regression"""

# License: BSD-3-Clause (see LICENSE file)
# copyright: skpro developers, BSD-3-Clause License (see LICENSE file)

from skpro.regression.gr._gaussian import GaussianRegressor

Expand Down
9 changes: 0 additions & 9 deletions skpro/regression/gr/_gaussian.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import numpy as np
from scipy.stats import norm

from skpro.utils.validation import check_X_y, check_is_fitted, check_array

from skpro.regression.adapters.sklearn import SklearnProbaReg
from skpro.regression.base.adapters import _DelegateWithFittedParamForwarding

Expand Down Expand Up @@ -127,8 +125,6 @@ def _fit(self, X, y):
self : GaussianRegressor
Fitted regressor.
"""
X, y = check_X_y(X, y)
check_is_fitted(self, ["_estimator"])

self._estimator.fit(X, y)
self.residuals_ = y - self.predict(X)
Expand Down Expand Up @@ -157,7 +153,6 @@ def score(self, X, y):
score : float
Negative log-likelihood of the Gaussian distribution.
"""
check_is_fitted(self, ["_estimator"])

residuals = y - self.predict(X)
return -norm.logpdf(residuals).sum()
Expand All @@ -178,8 +173,6 @@ def predict_proba(self, X):
the mean of the distribution, and the second column represents the
standard deviation.
"""
check_is_fitted(self, ["_estimator"])
X = check_array(X)

y_mean = self.predict(X)

Expand All @@ -206,8 +199,6 @@ def predict(self, X):
y_pred : array-like of shape (n_samples,) or (n_samples, n_targets)
Predicted values.
"""
check_is_fitted(self, ["_estimator"])
X = check_array(X)

return self._estimator.predict(X)

Expand Down