Bug in OPLSValidator
juenhint opened this issue · 1 comments
juenhint commented
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
mguinto commented
Hello, juenhint (and DPFoose)!
Would just like to ask about this as well.
Corroborating what's already been described above,
this is the error that shows up for me, even with the default wine dataset:
File ~/.spyder-py3/untitled13.py:20 in <module>
validator = OPLSValidator(k=5).fit(X, target)
File ~/.local/lib/python3.8/site-packages/pyopls/validation.py:454 in fit
y = self._check_target(y, pos_label)
File ~/.local/lib/python3.8/site-packages/pyopls/validation.py:225 in _check_target
y = self._process_binary_target(y, pos_label)
File ~/.local/lib/python3.8/site-packages/pyopls/validation.py:213 in _process_binary_target
self.binarizer_ = LabelBinarizer(-1, 1)
TypeError: __init__() takes 1 positional argument but 3 were given
Thank you very much!!