-
Notifications
You must be signed in to change notification settings - Fork 6
Adapt code and requirements for latest sklearn #194
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,5 @@ | ||
| numpy~=1.22.4 | ||
| scipy~=1.7.1 | ||
| matplotlib~=3.4.3 | ||
| scikit-learn~=1.0.1 | ||
| scikit-optimize~=0.9 | ||
| pandas~=1.3.4 | ||
| mlflow~=1.21.0 | ||
| hypothesis~=6.24.2 | ||
| joblib~=1.1.0 | ||
| tqdm~=4.62.3 | ||
| pytest~=6.2.5 | ||
| protobuf~=3.20.0 | ||
| matplotlib==3.10.3 | ||
| pandas==2.3.0 | ||
| pytest==8.4.1 | ||
| scikit-learn==1.7.0 | ||
| tqdm==4.67.1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,8 @@ | |
| import numpy as np | ||
| from sklearn import clone | ||
| from sklearn.utils import check_X_y | ||
| from sklearn.utils.validation import check_is_fitted, check_array | ||
| from sklearn.utils.validation import check_is_fitted, check_array, validate_data | ||
|
|
||
|
|
||
| from .base import BaseRegressor | ||
| from .exceptions import PopulationEmptyWarning | ||
|
|
@@ -22,6 +23,18 @@ | |
|
|
||
|
|
||
| class SupRB(BaseRegressor): | ||
| def __sklearn_tags__(self): | ||
|
heidmic marked this conversation as resolved.
|
||
| tags = super().__sklearn_tags__() | ||
| tags.target_tags.single_output = False | ||
| tags.non_deterministic = True | ||
| return tags | ||
|
|
||
| def _more_tags(self): | ||
| # additional or override tags | ||
| return { | ||
| # 'some_tag': True, | ||
| } | ||
|
|
||
| """The multi-solution batch learning LCS developed by the Organic Computing group at Universität Augsburg. | ||
|
|
||
| Parameters | ||
|
|
@@ -150,8 +163,7 @@ def fit(self, X: np.ndarray, y: np.ndarray, cleanup=False): | |
| self.elitist_.complexity_ = 99999 | ||
|
|
||
| # Check that x and y have correct shape | ||
| X, y = check_X_y(X, y, dtype="float64", y_numeric=True) | ||
| y = check_array(y, ensure_2d=False, dtype="float64") | ||
| X, y = validate_data(self, X, y, ensure_2d=True) | ||
|
|
||
| # Init sklearn interface | ||
| self.n_features_in_ = X.shape[1] | ||
|
|
@@ -273,11 +285,9 @@ def _compose_solution(self, X: np.ndarray, y: np.ndarray): | |
| # Optimize | ||
| self.solution_composition_.optimize(X, y) | ||
|
|
||
| def predict(self, X: np.ndarray): | ||
| # Check is fit had been called | ||
| check_is_fitted(self, ["is_fitted_"]) | ||
| # Input validation | ||
| X = check_array(X) | ||
| def predict(self, X): | ||
| check_is_fitted(self) | ||
| X = validate_data(self, X, ensure_2d=True, reset=False) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this a change in sklearn guidelines?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is also part of https://scikit-learn.org/stable/developers/develop.html and shall be used in the newer version |
||
|
|
||
| if hasattr(self, "is_error_") and self.is_error_: | ||
| return [0] * len(X) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.