Skip to content

Commit

Permalink
toolbox: if the shape of y is [n_samples, 1] or [1, n_samples], it wi…
Browse files Browse the repository at this point in the history
…ll flatten y automatically.
  • Loading branch information
tangypnuaa committed Jun 19, 2019
1 parent e2367f7 commit 8a12ae3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion alipy/toolbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ def __init__(self, y, X=None, instance_indexes=None,
self._index_len = None
# check and record parameters
self._y = check_array(y, ensure_2d=False, dtype=None)
ytype = type_of_target(y)
if self._y.shape[0] == 1 or self._y.shape[1] == 1:
self._y = self._y.flatten()
ytype = type_of_target(self._y)
if len(self._y.shape) == 2:
self._target_type = 'multilabel'
else:
Expand Down

0 comments on commit 8a12ae3

Please sign in to comment.