multiclass - type_of_target returning 'multiclass-output" despite size being 1? #19629
Replies: 2 comments
It's still a 2D array, meaning a numpy with 2 axis: >>> y = np.array([[1,2,3]])
>>> y.ndim
2
>>> y.shape
(1, 3)The first axis has size 1 and is expected to represent the number of samples. The second axis has size 3 and is expected to represent number of targets. If you want to do traditional (single target) multiclass, please just pass the column you want directly as a 1D array. For instance |
|
You're right. The current documentation says that type_of_target(np.array([[1, 2, 3]]))returns: This is because the implementation classifies a 2D array with more than two unique discrete values as So the issue is essentially a documentation mismatch/ambiguity, rather than something wrong with your interpretation of the shape. For comparison: np.array([[1, 2, 3]]).shape
# (1, 3)
type_of_target(np.array([[1, 2, 3]]))
# 'multiclass-multioutput'The documentation should therefore be clarified to accurately describe this edge case. |
Uh oh!
There was an error while loading. Please reload this page.
From the doc
but
Isn't this a 1 x 3 array. Both their dimension do not satisfy size > 1 (column does row doesn't)
What am I not understanding?
All reactions