question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
amuellercommented, Oct 25, 2017

encoding the targets as one-hot indicates to the estimator that you want it treated as a multi-label problem.

0reactions
bringtreecommented, Oct 26, 2017

oh, thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Identifying a Bug vs Insect - ThoughtCo
Technically, or taxonomically, a bug is a creature that belongs to the insect order Hemiptera, known commonly as the true bugs. Aphids, cicadas, ......
Read more >
Is It a Feature? Is it a Bug? No, It's an Antifeature.
A bug is a behavior, usually the result of an error or sloppy programming, that gets in the way of the features. Antifeatures,...
Read more >
What is a bug (computer bug)? - TechTarget
In computer technology, a bug is a coding error in a computer program. (We consider a program to also include the microcode that...
Read more >
'It's Not a Bug, It's a Feature.' Trite—or Just Right? - WIRED
A standard joke is that a bug can be turned into a feature simply by documenting it (then theoretically no one can complain...
Read more >
What Makes a Bug a True Bug? - VPM
To them, a true bug refers only to members of Hemiptera, an order of insects that also includes cicadas, hoppers, and aphids.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found