Skip to content

Bug in OPLSValidator #8

@juenhint

Description

@juenhint

The validator scripts are not working on any datasets, seems to be an issue with the fit method and the subsequent LabelBinarizer call. This is the error when running the example code:

TypeError                                 Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_19292/3997691689.py in <module>
     10 X = df[[c for c in df.columns if c!='classification']]
     11 
---> 12 validator = OPLSValidator(k=-1).fit(X, target)
     13 
     14 Z = validator.opls_.transform(X)

C:\devel\anaconda3\lib\site-packages\pyopls\validation.py in fit(self, X, y, n_components, cv, pos_label, random_state, n_jobs, verbose, pre_dispatch)
    452 
    453         X = check_array(X, dtype=float, copy=True)
--> 454         y = self._check_target(y, pos_label)
    455 
    456         if not n_components:

C:\devel\anaconda3\lib\site-packages\pyopls\validation.py in _check_target(self, y, pos_label)
    223                              'Try binarizing with sklearn.preprocessing.LabelBinarizer.')
    224         if self.is_discrimination(y):
--> 225             y = self._process_binary_target(y, pos_label)
    226         else:
    227             self.binarizer_ = None

C:\devel\anaconda3\lib\site-packages\pyopls\validation.py in _process_binary_target(self, y, pos_label)
    211 
    212     def _process_binary_target(self, y, pos_label=None):
--> 213         self.binarizer_ = LabelBinarizer(-1, 1)
    214         self.binarizer_.fit(y)
    215         if pos_label is not None and self.binarizer_.transform([pos_label])[0] == -1:

TypeError: __init__() takes 1 positional argument but 3 were give
```n

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions