Skip to content

Commit c137019

Browse files
committed
Updated main decision tree to be uniform with second image. Text is now color coded according to decision root
1 parent 4329c8a commit c137019

19 files changed

+141
-38
lines changed

.DS_Store

-2 KB
Binary file not shown.

Python_Basics/.DS_Store

4 KB
Binary file not shown.

Sklearn/.DS_Store

0 Bytes
Binary file not shown.

Sklearn/DecisionTrees/.DS_Store

4 KB
Binary file not shown.

Sklearn/DecisionTrees/.ipynb_checkpoints/DecisionTreeAnatomy-checkpoint.ipynb

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@
372372
},
373373
{
374374
"cell_type": "code",
375-
"execution_count": 14,
375+
"execution_count": 15,
376376
"metadata": {
377377
"collapsed": false
378378
},
@@ -384,7 +384,7 @@
384384
"<IPython.core.display.Image object>"
385385
]
386386
},
387-
"execution_count": 14,
387+
"execution_count": 15,
388388
"metadata": {},
389389
"output_type": "execute_result"
390390
}
@@ -398,17 +398,27 @@
398398
"cell_type": "markdown",
399399
"metadata": {},
400400
"source": [
401-
"I edited the file to have text colors using nano (text editor)"
401+
"I edited the file to have text colors using nano (text editor). Also I will make sure the resolution is higher. More on that here. "
402402
]
403403
},
404404
{
405405
"cell_type": "code",
406-
"execution_count": null,
406+
"execution_count": 19,
407407
"metadata": {
408-
"collapsed": true
408+
"collapsed": false
409409
},
410-
"outputs": [],
411-
"source": []
410+
"outputs": [
411+
{
412+
"name": "stdout",
413+
"output_type": "stream",
414+
"text": [
415+
"Error: dot: can't open Graphviz_Dot_Examples/irisGreenPinkDepth2.dot\r\n"
416+
]
417+
}
418+
],
419+
"source": [
420+
"!dot -Tpng -Gdpi=300 Graphviz_Dot_Examples/irisAllGreenDepth2.dot -o Graphviz_Dot_Examples/irisAllGreenDepth2.png"
421+
]
412422
},
413423
{
414424
"cell_type": "code",

Sklearn/DecisionTrees/DecisionTreeAnatomy.ipynb

Lines changed: 75 additions & 31 deletions
Large diffs are not rendered by default.
6 KB
Binary file not shown.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
digraph Tree {
2+
node [shape=box] ;
3+
0 [label="petal length (cm) <= 2.45\ngini = 0.665\nsamples = 112\nvalue = [38, 40, 34]\nclass = versicolor"] ;
4+
1 [label="gini = 0.0\nsamples = 38\nvalue = [38, 0, 0]\nclass = setosa"] ;
5+
0 -> 1 [labeldistance=2.5, labelangle=45, headlabel="True"] ;
6+
2 [label="petal length (cm) <= 4.95\ngini = 0.497\nsamples = 74\nvalue = [0, 40, 34]\nclass = versicolor"] ;
7+
0 -> 2 [labeldistance=2.5, labelangle=-45, headlabel="False"] ;
8+
3 [label="gini = 0.136\nsamples = 41\nvalue = [0, 38, 3]\nclass = versicolor"] ;
9+
2 -> 3 ;
10+
4 [label=<<FONT COLOR="#008000" FACE="boldfontname">node type: leaf</FONT><br/><FONT COLOR="black">gini = 0.114<br/>samples = 33<br/>value = [0, 2, 31]<br/>class = virginica</FONT>>] ;
11+
2 -> 4 ;
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
digraph Tree {
2+
node [shape=box, style=filled,fillcolor="#FFFFFF"] ;
3+
0 [label=<<FONT COLOR="#0000FF">petal length (cm) &le; 2.45<br/>gini = 0.665<br/>samples = 112<br/>value = [38, 40, 34]<br/>class = versicolor</FONT>>] ;
4+
1 [label=<<FONT COLOR="#008000">gini = 0.0<br/>samples = 38<br/>value = [38, 0, 0]<br/>class = setosa</FONT>>] ;
5+
0 -> 1 [labeldistance=2.5, labelangle=45, headlabel="True"] ;
6+
2 [label=<<FONT COLOR="#0000FF">petal length (cm) &le; 4.95<br/>gini = 0.497<br/>samples = 74<br/>value = [0, 40, 34]<br/>class = versicolor</FONT>>] ;
7+
0 -> 2 [labeldistance=2.5, labelangle=-45, headlabel="False"] ;
8+
3 [label=<<FONT COLOR="#008000">gini = 0.136<br/>samples = 41<br/>value = [0, 38, 3]<br/>class = versicolor</FONT>>] ;
9+
2 -> 3 [labeldistance=2.5, labelangle=45, headlabel="True"];
10+
4 [label=<<FONT COLOR="#008000">gini = 0.114<br/>samples = 33<br/>value = [0, 2, 31]<br/>class = virginica</FONT>>] ;
11+
2 -> 4 [labeldistance=2.5, labelangle=-45, headlabel="False"];
12+
}
199 KB
Loading

0 commit comments

Comments
 (0)