Skip to content

Commit

Permalink
[BUG] fix various bugs in delegated sklearn probabilistic regressors (
Browse files Browse the repository at this point in the history
#174)

This fixes various bugs in the delegated `sklearn` probabilistic
regressors:

* missing parameter write to `self`
* an erroneously passed parameter in the test cases
  • Loading branch information
fkiraly authored Jan 7, 2024
1 parent a1a5ef2 commit cb03d99
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
9 changes: 9 additions & 0 deletions skpro/regression/gp/_sklearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,15 @@ def __init__(
n_targets=None,
random_state=None,
):
self.kernel = kernel
self.alpha = alpha
self.optimizer = optimizer
self.n_restarts_optimizer = n_restarts_optimizer
self.normalize_y = normalize_y
self.copy_X_train = copy_X_train
self.n_targets = n_targets
self.random_state = random_state

from sklearn.gaussian_process import GaussianProcessRegressor

skl_estimator = GaussianProcessRegressor(
Expand Down
26 changes: 25 additions & 1 deletion skpro/regression/linear/_sklearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,18 @@ def __init__(
copy_X=True,
verbose=False,
):
self.max_iter = max_iter
self.tol = tol
self.alpha_1 = alpha_1
self.alpha_2 = alpha_2
self.lambda_1 = lambda_1
self.lambda_2 = lambda_2
self.compute_score = compute_score
self.threshold_lambda = threshold_lambda
self.fit_intercept = fit_intercept
self.copy_X = copy_X
self.verbose = verbose

from sklearn.linear_model import ARDRegression

skl_estimator = ARDRegression(
Expand Down Expand Up @@ -273,6 +285,19 @@ def __init__(
copy_X=True,
verbose=False,
):
self.max_iter = max_iter
self.tol = tol
self.alpha_1 = alpha_1
self.alpha_2 = alpha_2
self.lambda_1 = lambda_1
self.lambda_2 = lambda_2
self.alpha_init = alpha_init
self.lambda_init = lambda_init
self.compute_score = compute_score
self.fit_intercept = fit_intercept
self.copy_X = copy_X
self.verbose = verbose

from sklearn.linear_model import BayesianRidge

skl_estimator = BayesianRidge(
Expand Down Expand Up @@ -333,7 +358,6 @@ def get_test_params(cls, parameter_set="default"):
"lambda_1": 2e-6,
"lambda_2": 2e-6,
"compute_score": True,
"threshold_lambda": 15000.0,
"fit_intercept": False,
}
return [param1, param2]

0 comments on commit cb03d99

Please sign in to comment.