Skip to content

Commit

Permalink
FIX ColumnKernelizer for sklearn 1.5 (#61)
Browse files Browse the repository at this point in the history
Co-authored-by: Yuerou Tang <yuerou.tang@berkeley.edu>
  • Loading branch information
mvdoc and yuerout authored Jun 12, 2024
1 parent 152f131 commit 67c1137
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
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

0 comments on commit 67c1137

Please sign in to comment.