Created
July 2, 2018 21:49
-
-
Save mutafaf/7715ad67bc3cf4e08985afefcc0ce08a to your computer and use it in GitHub Desktop.
Data Science - Decision Tree
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
age | dis | gen | |
---|---|---|---|
30 | 0 | 0 | |
29 | 1 | 1 | |
29 | 2 | 1 | |
29 | 3 | 1 | |
29 | 4 | 1 | |
29 | 5 | 1 | |
29 | 6 | 1 | |
29 | 7 | 1 | |
29 | 8 | 1 | |
29 | 9 | 1 | |
29 | 10 | 1 | |
29 | 11 | 1 | |
29 | 12 | 1 | |
29 | 1 | 1 | |
29 | 2 | 1 | |
29 | 3 | 1 | |
29 | 4 | 1 | |
29 | 5 | 1 | |
29 | 6 | 1 | |
29 | 8 | 1 | |
29 | 12 | 1 | |
29 | 10 | 1 | |
29 | 7 | 1 | |
29 | 9 | 1 | |
29 | 13 | 1 | |
29 | 11 | 1 | |
29 | 1 | 1 | |
29 | 2 | 1 | |
29 | 3 | 1 | |
29 | 4 | 1 | |
29 | 5 | 1 | |
29 | 6 | 1 | |
29 | 8 | 1 | |
29 | 12 | 1 | |
29 | 10 | 1 | |
29 | 7 | 1 | |
29 | 9 | 1 | |
29 | 13 | 1 | |
29 | 11 | 1 | |
29 | 1 | 1 | |
29 | 2 | 1 | |
29 | 3 | 1 | |
29 | 4 | 1 | |
29 | 5 | 1 | |
29 | 6 | 1 | |
29 | 8 | 1 | |
29 | 12 | 1 | |
29 | 10 | 1 | |
29 | 7 | 1 | |
29 | 9 | 1 | |
29 | 13 | 1 | |
29 | 11 | 1 | |
27 | 14 | 2 | |
27 | 15 | 2 | |
27 | 16 | 2 | |
27 | 17 | 2 | |
27 | 18 | 2 | |
27 | 19 | 2 | |
27 | 8 | 2 | |
27 | 20 | 2 | |
27 | 21 | 2 | |
27 | 22 | 2 | |
27 | 23 | 2 | |
27 | 16 | 2 | |
27 | 24 | 2 | |
27 | 25 | 2 | |
27 | 26 | 2 | |
27 | 15 | 2 | |
27 | 18 | 2 | |
27 | 27 | 2 | |
27 | 28 | 2 | |
27 | 14 | 2 | |
27 | 16 | 2 | |
27 | 19 | 2 | |
27 | 15 | 2 | |
27 | 17 | 2 | |
27 | 18 | 2 | |
31 | 14 | 0 | |
31 | 16 | 0 | |
31 | 19 | 0 | |
31 | 29 | 0 | |
31 | 26 | 0 | |
31 | 30 | 0 | |
31 | 14 | 0 | |
31 | 29 | 0 | |
31 | 16 | 0 | |
31 | 26 | 0 | |
31 | 30 | 0 | |
31 | 19 | 0 | |
28 | 31 | 1 | |
35 | 32 | 1 | |
35 | 33 | 1 | |
35 | 8 | 1 | |
35 | 34 | 1 | |
35 | 35 | 1 | |
35 | 26 | 1 | |
35 | 36 | 1 | |
35 | 21 | 1 | |
35 | 17 | 1 | |
31 | 27 | 1 |
Sorry, can't answer your question. Hopefully someone with experience can answer well @parthsalunke.
Best.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You are supposed to pass
numpy
arrays and not lists as arguments to theDecisionTree
, since your input was a list it gets trained as 70 features (1D list) and your test hadlist
of 30 elements and the classifier sees it as 30 features.Nonetheless, you need to reshape your input
numpy
array and pass it as a matrixmeaning:
X_train.values.reshape(-1, 1)
instead ofX_train
(it should be anumpy
array not alist
)this is the entire gist:
I'm getting the following output:
Thanks for sharing the dataset. It was helpful for testing it. Hope this helps.