lab-cosmo/kernel-tutorials

Error in variable name 'n_features_to_select' in kernel-tutorials/utilities/general.py (line 117)

Closed this issue · 1 comments

A-614 commented

1_LinearMethods.ipynb

Error message is received when running the following cell.
The variable name should be 'n_to_select' after its change in scikit-cosmo.

var_dict = load_variables()
locals().update(var_dict)
--------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-17-82d4ac1ba4d8> in <module>
----> 1 var_dict = load_variables()
      2 locals().update(var_dict)

kernel-tutorials/utilities/general.py in load_variables(cache_name, **kwargs)
     93         X, y = load_csd_1000r(return_X_y=True)
     94         data = dict(X=X, Y=y, indices=np.array([]))
---> 95     return calculate_variables(**dict(data), **kwargs)
     96 
     97 

kernel-tutorials/utilities/general.py in calculate_variables(X, Y, indices, n_atoms, N, n_FPS, kernel_func, i_train, i_test, n_train, K_train, K_test)
    115 
    116     if n_FPS is not None and n_FPS < X.shape[1]:
--> 117         fps_idxs = FPS(n_features_to_select=n_FPS).fit(X).selected_idx_
    118         print("Taking a subsampling of ", n_FPS, "features")
    119         X = X[:, fps_idxs]

miniconda3/lib/python3.9/site-packages/skcosmo/feature_selection/_base.py in __init__(self, **kwargs)
     15 
     16     def __init__(self, **kwargs):
---> 17         super().__init__(selection_type="feature", **kwargs)
     18 
     19 

miniconda3/lib/python3.9/site-packages/skcosmo/_selection.py in __init__(self, initialize, **kwargs)
    817         self.initialize = initialize
    818 
--> 819         super().__init__(
    820             **kwargs,
    821         )

TypeError: __init__() got an unexpected keyword argument 'n_features_to_select'

Fixed in dbc31b9