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

Rename to model_selection, GridSearchCV and LineSearchCV #58

Merged
merged 6 commits into from
Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
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
4 changes: 2 additions & 2 deletions sparselm/optimizer.py → sparselm/model_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from sklearn.utils.validation import _check_fit_params, indexable


class GridSearch(GridSearchCV):
class OneSEGridSearchCV(GridSearchCV):
"""Exhaustive search over specified parameter values for an estimator.

Same as GridSearchCV but we allow one standard error rule on all
Expand Down Expand Up @@ -636,7 +636,7 @@ def fit(self, X, y=None, *, groups=None, **fit_params):
):
param_line[name] = [last_value] if pid != param_id else values

grid_search = GridSearch(
grid_search = OneSEGridSearchCV(
estimator=self.estimator,
param_grid=param_line,
opt_selection_method=self.opt_selection_methods[param_id],
Expand Down
4 changes: 2 additions & 2 deletions tests/test_optimizers.py → tests/test_model_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import pytest

from sparselm.model.miqp._regularized_l0 import L1L0, L2L0
from sparselm.optimizer import GridSearch, LineSearch
from sparselm.model_selection import OneSEGridSearchCV, LineSearch

ALL_CRITERION = ["max_score", "one_std_score"]
# Currently we will only test on mixedL0
Expand Down Expand Up @@ -88,7 +88,7 @@ def test_mixed_l0_wts(random_model, mixed_l2l0_est, random_weights):

@pytest.fixture(scope="module", params=ALL_CRITERION)
def grid_search(estimator, param_grid, request):
grid_searcher = GridSearch(
grid_searcher = OneSEGridSearchCV(
estimator, param_grid, opt_selection_method=request.param
)
return grid_searcher
Expand Down