Manual

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 2

DownloadManual
Open PDF In BrowserView PDF
Decision Tree Visualization Macro
1. Macro Name: DecisionTree
2.Input: Dot. File output from [pydotplus] module
(#Warning: This tool only applies to balanced binary tree)
3.Output: DecisionTree with Lift Rate on Excel
Simple Code of pydotplus module
# Create DOT data
tree.export_graphviz(mod, out_file='tree.dot',
feature_names=data_all.columns[:-1],
class_names=None,
impurity=True,
filled=False,
proportion=None)
# Convert to png
graph = pydotplus.graphviz.graph_from_dot_file('tree.dot')
# Show graph
graph.write_png('tree.png')

2. Simple Use Case
Input: tree.dot
digraph Tree {
node [shape=box] ;
0 [label="スイーツ・お菓子 <= 2311.5\ngini = 0.031\nsamples = 199864\nvalue = [196719, 3145]"] ;
1 [label="家電 <= 97.5\ngini = 0.027\nsamples = 178648\nvalue = [176170, 2478]"] ;
0 -> 1 [labeldistance=2.5, labelangle=45, headlabel="True"] ;
2 [label="reg_gender_cd <= 0.5\ngini = 0.022\nsamples = 145100\nvalue = [143451, 1649]"] ;
1 -> 2 ;
3 [label="gini = 0.0\nsamples = 23106\nvalue = [23104, 2]"] ;
2 -> 3 ;
4 [label="gini = 0.027\nsamples = 121994\nvalue = [120347, 1647]"] ;
2 -> 4 ;
5 [label="パソコン・周辺機器 <= 95.0\ngini = 0.048\nsamples = 33548\nvalue = [32719, 829]"] ;
1 -> 5 ;
6 [label="gini = 0.037\nsamples = 26666\nvalue = [26166, 500]"] ;
5 -> 6 ;
…………………………………

Sample output:
Proportion

reg_gender_cd <= 0.5,samples = 23106,nvalue
= 2,yprob = 0.01%

Lift Rate

Population

samples = 23106,nvalue = 2

0.01%

0.01

2

samples = 121994,nvalue = 1647

1.35%

0.86

1647

samples = 26666,nvalue = 500

1.88%

1.2

500

samples = 6882,nvalue = 329

4.78%

3.04

329

samples = 10590,nvalue = 203

1.92%

1.22

203

samples = 3622,nvalue = 175

4.83%

3.08

175

samples = 3823,nvalue = 121

3.17%

2.02

121

samples = 3181,nvalue = 168

5.28%

3.36

168

家電 <= 97.5,nsamples =
145100,nvalue = 1649,yprob =
1.14%
reg_gender_cd >= 0.5,samples = 121994,nvalue
スイーツ・お菓子 <=

= 1647,yprob = 1.35%

2311.5,nsamples =
178648,nvalue = 2478,yprob
= 1.39%

パソコン・周辺機器 <= 95.0,samples =
26666,nvalue = 500,yprob = 1.88%
家電 >= 97.5,nsamples =
33548,nvalue = 829,yprob =
2.47%

nsamples =

パソコン・周辺機器 >= 95.0,samples =
6882,nvalue = 329,yprob = 4.78%

199864,nvalue =
3145,yprob = 1.57%

本・雑誌・コミック <= 539.5,samples =
日用品雑貨・文房具・手芸 <=

10590,nvalue = 203,yprob = 1.92%
5039.0,nsamples = 14212,nvalue
= 378,yprob = 2.66%
スイーツ・お菓子 >=

本・雑誌・コミック >= 539.5,samples =
3622,nvalue = 175,yprob = 4.83%

2311.5,nsamples =
21216,nvalue = 667,yprob =
3.14%

ダイエット・健康 <= 5060.0,samples =
日用品雑貨・文房具・手芸 >=

3823,nvalue = 121,yprob = 3.17%

5039.0,nsamples = 7004,nvalue
= 289,yprob = 4.13%

ダイエット・健康 >= 5060.0,samples =
3181,nvalue = 168,yprob = 5.28%



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.5
Linearized                      : No
Page Count                      : 2
Language                        : ja-JP
Tagged PDF                      : Yes
XMP Toolkit                     : 3.1-701
Producer                        : Microsoft® Word 2016
Creator                         : Bao, Long | Lorentz | SECB
Creator Tool                    : Microsoft® Word 2016
Create Date                     : 2018:11:08 17:48:41+09:00
Modify Date                     : 2018:11:08 17:48:41+09:00
Document ID                     : uuid:35365943-3ADF-47BF-9618-69B26B03578D
Instance ID                     : uuid:35365943-3ADF-47BF-9618-69B26B03578D
Author                          : Bao, Long | Lorentz | SECB
EXIF Metadata provided by EXIF.tools

Navigation menu