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

FIX ColumnKernelizer for sklearn 1.5 #61

Merged
merged 3 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 8 additions & 1 deletion himalaya/kernel_ridge/_kernelizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,11 @@ class ColumnKernelizer(ColumnTransformer):
If True, computations will be performed on CPU, ignoring the
current backend. If False, use the current backend.

force_int_remainder_cols : bool, default=True
Force the columns of the last entry of transformers_, which corresponds
to the “remainder” transformer, to always be stored as indices (int)
rather than column names (str).

Attributes
----------
transformers_ : list
Expand Down Expand Up @@ -308,14 +313,16 @@ class ColumnKernelizer(ColumnTransformer):
kernelizer = False

def __init__(self, transformers, remainder='drop', n_jobs=None,
transformer_weights=None, verbose=False, force_cpu=False):
transformer_weights=None, verbose=False, force_cpu=False,
force_int_remainder_cols=True):
self.transformers = transformers
self.remainder = remainder
self.sparse_threshold = 0
self.n_jobs = n_jobs
self.transformer_weights = transformer_weights
self.verbose = verbose
self.force_cpu = force_cpu
self.force_int_remainder_cols = force_int_remainder_cols

def _iter(self, fitted=False, *args, **kwargs):
"""
Expand Down
2 changes: 1 addition & 1 deletion himalaya/kernel_ridge/_random_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def solve_multiple_kernel_ridge_random_search(
warnings.warn("Skip fit because HIMALAYA_SKIP_FIT=True.")
# skip the loop by emptying the gammas candidates
gammas = gammas[:0]
# fill with fake weights, to avoid gettings only zeros.
# fill with fake weights, to avoid getting only zeros.
refit_weights += (backend.arange(n_targets)[None] + 1) / n_targets

###########################################################################
Expand Down