Skip to content

is it a bug? #9988

@bringtree

Description

@bringtree

Description

an err output, In my train_output, it does not exist [0,0]

Steps/Code to Reproduce

from sklearn import tree

X = [[1, 1], [1, 2], [1, 3], [1, 4], [2, 1], [2, 2], [2, 3], [2, 4]]
Y = [[0, 1], [0, 1], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0]]
# Y = [[0], [0], [1], [1], [1], [1], [1], [1]]

clf = tree.DecisionTreeClassifier(criterion='entropy', max_depth=1)
clf.fit(X, Y)
print(clf.predict([[1, 1], [1, 2], [1, 3], [1, 4], [2, 1], [2, 2], [2, 3], [2, 4]]))

Expected Results

[[ 0. 1.]
[ 0. 1.]
[ 0. 1.]
[ 0. 1.]
[ 1. 0.]
[ 1. 0.]
[ 1. 0.]
[ 1. 0.]]

Actual Results

[[ 0. 0.]
[ 0. 0.]
[ 0. 0.]
[ 0. 0.]
[ 1. 0.]
[ 1. 0.]
[ 1. 0.]
[ 1. 0.]]

Versions

Darwin-16.7.0-x86_64-i386-64bit
Python 3.6.1 (v3.6.1:69c0db5050, Mar 21 2017, 01:21:04)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
NumPy 1.13.3
SciPy 0.19.1
Scikit-Learn 0.19.0

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