forked from s474139/Inteligentny_Wozek
Add decison tree and its visualization
This commit is contained in:
parent
7f29b165d7
commit
c2079d8811
197
DecisionTree/Source.gv
Normal file
197
DecisionTree/Source.gv
Normal file
@ -0,0 +1,197 @@
|
||||
digraph Tree {
|
||||
node [shape=box, style="filled, rounded", color="black", fontname="helvetica"] ;
|
||||
edge [fontname="helvetica"] ;
|
||||
0 [label="g > d <= 0.5\nentropy = 0.997\nsamples = 200\nvalue = [94, 106]\nclass = 1", fillcolor="#e9f4fc"] ;
|
||||
1 [label="waga, <= 0.5\nentropy = 0.803\nsamples = 98\nvalue = [74, 24]\nclass = 0", fillcolor="#edaa79"] ;
|
||||
0 -> 1 [labeldistance=2.5, labelangle=45, headlabel="True"] ;
|
||||
2 [label="wielkosc <= 1.5\nentropy = 0.998\nsamples = 34\nvalue = [16, 18]\nclass = 1", fillcolor="#e9f4fc"] ;
|
||||
1 -> 2 ;
|
||||
3 [label="priorytet <= 0.5\nentropy = 0.887\nsamples = 23\nvalue = [7, 16]\nclass = 1", fillcolor="#90c8f0"] ;
|
||||
2 -> 3 ;
|
||||
4 [label="kruchosc <= 0.5\nentropy = 0.439\nsamples = 11\nvalue = [1, 10]\nclass = 1", fillcolor="#4da7e8"] ;
|
||||
3 -> 4 ;
|
||||
5 [label="entropy = 0.0\nsamples = 7\nvalue = [0, 7]\nclass = 1", fillcolor="#399de5"] ;
|
||||
4 -> 5 ;
|
||||
6 [label="wielkosc <= 0.5\nentropy = 0.811\nsamples = 4\nvalue = [1, 3]\nclass = 1", fillcolor="#7bbeee"] ;
|
||||
4 -> 6 ;
|
||||
7 [label="ksztalt <= 0.5\nentropy = 0.918\nsamples = 3\nvalue = [1, 2]\nclass = 1", fillcolor="#9ccef2"] ;
|
||||
6 -> 7 ;
|
||||
8 [label="entropy = 0.0\nsamples = 1\nvalue = [0, 1]\nclass = 1", fillcolor="#399de5"] ;
|
||||
7 -> 8 ;
|
||||
9 [label="gorna <= 0.5\nentropy = 1.0\nsamples = 2\nvalue = [1, 1]\nclass = 0", fillcolor="#ffffff"] ;
|
||||
7 -> 9 ;
|
||||
10 [label="entropy = 0.0\nsamples = 1\nvalue = [1, 0]\nclass = 0", fillcolor="#e58139"] ;
|
||||
9 -> 10 ;
|
||||
11 [label="entropy = 0.0\nsamples = 1\nvalue = [0, 1]\nclass = 1", fillcolor="#399de5"] ;
|
||||
9 -> 11 ;
|
||||
12 [label="entropy = 0.0\nsamples = 1\nvalue = [0, 1]\nclass = 1", fillcolor="#399de5"] ;
|
||||
6 -> 12 ;
|
||||
13 [label="kruchosc <= 0.5\nentropy = 1.0\nsamples = 12\nvalue = [6, 6]\nclass = 0", fillcolor="#ffffff"] ;
|
||||
3 -> 13 ;
|
||||
14 [label="entropy = 0.0\nsamples = 5\nvalue = [5, 0]\nclass = 0", fillcolor="#e58139"] ;
|
||||
13 -> 14 ;
|
||||
15 [label="ksztalt <= 0.5\nentropy = 0.592\nsamples = 7\nvalue = [1, 6]\nclass = 1", fillcolor="#5aade9"] ;
|
||||
13 -> 15 ;
|
||||
16 [label="entropy = 0.0\nsamples = 4\nvalue = [0, 4]\nclass = 1", fillcolor="#399de5"] ;
|
||||
15 -> 16 ;
|
||||
17 [label="gorna <= 0.5\nentropy = 0.918\nsamples = 3\nvalue = [1, 2]\nclass = 1", fillcolor="#9ccef2"] ;
|
||||
15 -> 17 ;
|
||||
18 [label="entropy = 0.0\nsamples = 1\nvalue = [1, 0]\nclass = 0", fillcolor="#e58139"] ;
|
||||
17 -> 18 ;
|
||||
19 [label="entropy = 0.0\nsamples = 2\nvalue = [0, 2]\nclass = 1", fillcolor="#399de5"] ;
|
||||
17 -> 19 ;
|
||||
20 [label="ksztalt <= 0.5\nentropy = 0.684\nsamples = 11\nvalue = [9, 2]\nclass = 0", fillcolor="#eb9d65"] ;
|
||||
2 -> 20 ;
|
||||
21 [label="dolna <= 0.5\nentropy = 1.0\nsamples = 4\nvalue = [2, 2]\nclass = 0", fillcolor="#ffffff"] ;
|
||||
20 -> 21 ;
|
||||
22 [label="kruchosc <= 0.5\nentropy = 0.918\nsamples = 3\nvalue = [1, 2]\nclass = 1", fillcolor="#9ccef2"] ;
|
||||
21 -> 22 ;
|
||||
23 [label="entropy = 0.0\nsamples = 1\nvalue = [1, 0]\nclass = 0", fillcolor="#e58139"] ;
|
||||
22 -> 23 ;
|
||||
24 [label="entropy = 0.0\nsamples = 2\nvalue = [0, 2]\nclass = 1", fillcolor="#399de5"] ;
|
||||
22 -> 24 ;
|
||||
25 [label="entropy = 0.0\nsamples = 1\nvalue = [1, 0]\nclass = 0", fillcolor="#e58139"] ;
|
||||
21 -> 25 ;
|
||||
26 [label="entropy = 0.0\nsamples = 7\nvalue = [7, 0]\nclass = 0", fillcolor="#e58139"] ;
|
||||
20 -> 26 ;
|
||||
27 [label="gorna <= 0.5\nentropy = 0.449\nsamples = 64\nvalue = [58, 6]\nclass = 0", fillcolor="#e88e4d"] ;
|
||||
1 -> 27 ;
|
||||
28 [label="entropy = 0.0\nsamples = 33\nvalue = [33, 0]\nclass = 0", fillcolor="#e58139"] ;
|
||||
27 -> 28 ;
|
||||
29 [label="wielkosc <= 1.5\nentropy = 0.709\nsamples = 31\nvalue = [25, 6]\nclass = 0", fillcolor="#eb9f69"] ;
|
||||
27 -> 29 ;
|
||||
30 [label="ksztalt <= 0.5\nentropy = 0.918\nsamples = 18\nvalue = [12, 6]\nclass = 0", fillcolor="#f2c09c"] ;
|
||||
29 -> 30 ;
|
||||
31 [label="kruchosc <= 0.5\nentropy = 1.0\nsamples = 10\nvalue = [5, 5]\nclass = 0", fillcolor="#ffffff"] ;
|
||||
30 -> 31 ;
|
||||
32 [label="dolna <= 0.5\nentropy = 0.722\nsamples = 5\nvalue = [4, 1]\nclass = 0", fillcolor="#eca06a"] ;
|
||||
31 -> 32 ;
|
||||
33 [label="priorytet <= 0.5\nentropy = 1.0\nsamples = 2\nvalue = [1, 1]\nclass = 0", fillcolor="#ffffff"] ;
|
||||
32 -> 33 ;
|
||||
34 [label="entropy = 0.0\nsamples = 1\nvalue = [0, 1]\nclass = 1", fillcolor="#399de5"] ;
|
||||
33 -> 34 ;
|
||||
35 [label="entropy = 0.0\nsamples = 1\nvalue = [1, 0]\nclass = 0", fillcolor="#e58139"] ;
|
||||
33 -> 35 ;
|
||||
36 [label="entropy = 0.0\nsamples = 3\nvalue = [3, 0]\nclass = 0", fillcolor="#e58139"] ;
|
||||
32 -> 36 ;
|
||||
37 [label="dolna <= 0.5\nentropy = 0.722\nsamples = 5\nvalue = [1, 4]\nclass = 1", fillcolor="#6ab6ec"] ;
|
||||
31 -> 37 ;
|
||||
38 [label="entropy = 0.0\nsamples = 3\nvalue = [0, 3]\nclass = 1", fillcolor="#399de5"] ;
|
||||
37 -> 38 ;
|
||||
39 [label="waga, <= 1.5\nentropy = 1.0\nsamples = 2\nvalue = [1, 1]\nclass = 0", fillcolor="#ffffff"] ;
|
||||
37 -> 39 ;
|
||||
40 [label="entropy = 0.0\nsamples = 1\nvalue = [1, 0]\nclass = 0", fillcolor="#e58139"] ;
|
||||
39 -> 40 ;
|
||||
41 [label="entropy = 0.0\nsamples = 1\nvalue = [0, 1]\nclass = 1", fillcolor="#399de5"] ;
|
||||
39 -> 41 ;
|
||||
42 [label="waga, <= 1.5\nentropy = 0.544\nsamples = 8\nvalue = [7, 1]\nclass = 0", fillcolor="#e99355"] ;
|
||||
30 -> 42 ;
|
||||
43 [label="entropy = 0.0\nsamples = 4\nvalue = [4, 0]\nclass = 0", fillcolor="#e58139"] ;
|
||||
42 -> 43 ;
|
||||
44 [label="wielkosc <= 0.5\nentropy = 0.811\nsamples = 4\nvalue = [3, 1]\nclass = 0", fillcolor="#eeab7b"] ;
|
||||
42 -> 44 ;
|
||||
45 [label="entropy = 0.0\nsamples = 1\nvalue = [1, 0]\nclass = 0", fillcolor="#e58139"] ;
|
||||
44 -> 45 ;
|
||||
46 [label="kruchosc <= 0.5\nentropy = 0.918\nsamples = 3\nvalue = [2, 1]\nclass = 0", fillcolor="#f2c09c"] ;
|
||||
44 -> 46 ;
|
||||
47 [label="entropy = 0.0\nsamples = 1\nvalue = [1, 0]\nclass = 0", fillcolor="#e58139"] ;
|
||||
46 -> 47 ;
|
||||
48 [label="priorytet <= 0.5\nentropy = 1.0\nsamples = 2\nvalue = [1, 1]\nclass = 0", fillcolor="#ffffff"] ;
|
||||
46 -> 48 ;
|
||||
49 [label="entropy = 0.0\nsamples = 1\nvalue = [0, 1]\nclass = 1", fillcolor="#399de5"] ;
|
||||
48 -> 49 ;
|
||||
50 [label="entropy = 0.0\nsamples = 1\nvalue = [1, 0]\nclass = 0", fillcolor="#e58139"] ;
|
||||
48 -> 50 ;
|
||||
51 [label="entropy = 0.0\nsamples = 13\nvalue = [13, 0]\nclass = 0", fillcolor="#e58139"] ;
|
||||
29 -> 51 ;
|
||||
52 [label="wielkosc <= 1.5\nentropy = 0.714\nsamples = 102\nvalue = [20, 82]\nclass = 1", fillcolor="#69b5eb"] ;
|
||||
0 -> 52 [labeldistance=2.5, labelangle=-45, headlabel="False"] ;
|
||||
53 [label="waga, <= 0.5\nentropy = 0.469\nsamples = 70\nvalue = [7, 63]\nclass = 1", fillcolor="#4fa8e8"] ;
|
||||
52 -> 53 ;
|
||||
54 [label="entropy = 0.0\nsamples = 21\nvalue = [0, 21]\nclass = 1", fillcolor="#399de5"] ;
|
||||
53 -> 54 ;
|
||||
55 [label="ksztalt <= 0.5\nentropy = 0.592\nsamples = 49\nvalue = [7, 42]\nclass = 1", fillcolor="#5aade9"] ;
|
||||
53 -> 55 ;
|
||||
56 [label="wielkosc <= 0.5\nentropy = 0.25\nsamples = 24\nvalue = [1, 23]\nclass = 1", fillcolor="#42a1e6"] ;
|
||||
55 -> 56 ;
|
||||
57 [label="entropy = 0.0\nsamples = 15\nvalue = [0, 15]\nclass = 1", fillcolor="#399de5"] ;
|
||||
56 -> 57 ;
|
||||
58 [label="kruchosc <= 0.5\nentropy = 0.503\nsamples = 9\nvalue = [1, 8]\nclass = 1", fillcolor="#52a9e8"] ;
|
||||
56 -> 58 ;
|
||||
59 [label="dolna <= 0.5\nentropy = 0.722\nsamples = 5\nvalue = [1, 4]\nclass = 1", fillcolor="#6ab6ec"] ;
|
||||
58 -> 59 ;
|
||||
60 [label="entropy = 0.0\nsamples = 2\nvalue = [0, 2]\nclass = 1", fillcolor="#399de5"] ;
|
||||
59 -> 60 ;
|
||||
61 [label="gorna <= 0.5\nentropy = 0.918\nsamples = 3\nvalue = [1, 2]\nclass = 1", fillcolor="#9ccef2"] ;
|
||||
59 -> 61 ;
|
||||
62 [label="priorytet <= 0.5\nentropy = 1.0\nsamples = 2\nvalue = [1, 1]\nclass = 0", fillcolor="#ffffff"] ;
|
||||
61 -> 62 ;
|
||||
63 [label="entropy = 0.0\nsamples = 1\nvalue = [0, 1]\nclass = 1", fillcolor="#399de5"] ;
|
||||
62 -> 63 ;
|
||||
64 [label="entropy = 0.0\nsamples = 1\nvalue = [1, 0]\nclass = 0", fillcolor="#e58139"] ;
|
||||
62 -> 64 ;
|
||||
65 [label="entropy = 0.0\nsamples = 1\nvalue = [0, 1]\nclass = 1", fillcolor="#399de5"] ;
|
||||
61 -> 65 ;
|
||||
66 [label="entropy = 0.0\nsamples = 4\nvalue = [0, 4]\nclass = 1", fillcolor="#399de5"] ;
|
||||
58 -> 66 ;
|
||||
67 [label="kruchosc <= 0.5\nentropy = 0.795\nsamples = 25\nvalue = [6, 19]\nclass = 1", fillcolor="#78bced"] ;
|
||||
55 -> 67 ;
|
||||
68 [label="priorytet <= 0.5\nentropy = 0.98\nsamples = 12\nvalue = [5, 7]\nclass = 1", fillcolor="#c6e3f8"] ;
|
||||
67 -> 68 ;
|
||||
69 [label="dolna <= 0.5\nentropy = 0.764\nsamples = 9\nvalue = [2, 7]\nclass = 1", fillcolor="#72b9ec"] ;
|
||||
68 -> 69 ;
|
||||
70 [label="entropy = 0.0\nsamples = 5\nvalue = [0, 5]\nclass = 1", fillcolor="#399de5"] ;
|
||||
69 -> 70 ;
|
||||
71 [label="gorna <= 0.5\nentropy = 1.0\nsamples = 4\nvalue = [2, 2]\nclass = 0", fillcolor="#ffffff"] ;
|
||||
69 -> 71 ;
|
||||
72 [label="entropy = 0.0\nsamples = 2\nvalue = [2, 0]\nclass = 0", fillcolor="#e58139"] ;
|
||||
71 -> 72 ;
|
||||
73 [label="entropy = 0.0\nsamples = 2\nvalue = [0, 2]\nclass = 1", fillcolor="#399de5"] ;
|
||||
71 -> 73 ;
|
||||
74 [label="entropy = 0.0\nsamples = 3\nvalue = [3, 0]\nclass = 0", fillcolor="#e58139"] ;
|
||||
68 -> 74 ;
|
||||
75 [label="dolna <= 0.5\nentropy = 0.391\nsamples = 13\nvalue = [1, 12]\nclass = 1", fillcolor="#49a5e7"] ;
|
||||
67 -> 75 ;
|
||||
76 [label="entropy = 0.0\nsamples = 7\nvalue = [0, 7]\nclass = 1", fillcolor="#399de5"] ;
|
||||
75 -> 76 ;
|
||||
77 [label="gorna <= 0.5\nentropy = 0.65\nsamples = 6\nvalue = [1, 5]\nclass = 1", fillcolor="#61b1ea"] ;
|
||||
75 -> 77 ;
|
||||
78 [label="priorytet <= 0.5\nentropy = 0.918\nsamples = 3\nvalue = [1, 2]\nclass = 1", fillcolor="#9ccef2"] ;
|
||||
77 -> 78 ;
|
||||
79 [label="entropy = 0.0\nsamples = 2\nvalue = [0, 2]\nclass = 1", fillcolor="#399de5"] ;
|
||||
78 -> 79 ;
|
||||
80 [label="entropy = 0.0\nsamples = 1\nvalue = [1, 0]\nclass = 0", fillcolor="#e58139"] ;
|
||||
78 -> 80 ;
|
||||
81 [label="entropy = 0.0\nsamples = 3\nvalue = [0, 3]\nclass = 1", fillcolor="#399de5"] ;
|
||||
77 -> 81 ;
|
||||
82 [label="gorna <= 0.5\nentropy = 0.974\nsamples = 32\nvalue = [13, 19]\nclass = 1", fillcolor="#c0e0f7"] ;
|
||||
52 -> 82 ;
|
||||
83 [label="kruchosc <= 0.5\nentropy = 0.65\nsamples = 12\nvalue = [10, 2]\nclass = 0", fillcolor="#ea9a61"] ;
|
||||
82 -> 83 ;
|
||||
84 [label="entropy = 0.0\nsamples = 7\nvalue = [7, 0]\nclass = 0", fillcolor="#e58139"] ;
|
||||
83 -> 84 ;
|
||||
85 [label="waga, <= 1.5\nentropy = 0.971\nsamples = 5\nvalue = [3, 2]\nclass = 0", fillcolor="#f6d5bd"] ;
|
||||
83 -> 85 ;
|
||||
86 [label="priorytet <= 0.5\nentropy = 0.918\nsamples = 3\nvalue = [1, 2]\nclass = 1", fillcolor="#9ccef2"] ;
|
||||
85 -> 86 ;
|
||||
87 [label="entropy = 0.0\nsamples = 2\nvalue = [0, 2]\nclass = 1", fillcolor="#399de5"] ;
|
||||
86 -> 87 ;
|
||||
88 [label="entropy = 0.0\nsamples = 1\nvalue = [1, 0]\nclass = 0", fillcolor="#e58139"] ;
|
||||
86 -> 88 ;
|
||||
89 [label="entropy = 0.0\nsamples = 2\nvalue = [2, 0]\nclass = 0", fillcolor="#e58139"] ;
|
||||
85 -> 89 ;
|
||||
90 [label="dolna <= 0.5\nentropy = 0.61\nsamples = 20\nvalue = [3, 17]\nclass = 1", fillcolor="#5caeea"] ;
|
||||
82 -> 90 ;
|
||||
91 [label="entropy = 0.0\nsamples = 11\nvalue = [0, 11]\nclass = 1", fillcolor="#399de5"] ;
|
||||
90 -> 91 ;
|
||||
92 [label="kruchosc <= 0.5\nentropy = 0.918\nsamples = 9\nvalue = [3, 6]\nclass = 1", fillcolor="#9ccef2"] ;
|
||||
90 -> 92 ;
|
||||
93 [label="waga, <= 0.5\nentropy = 0.811\nsamples = 4\nvalue = [3, 1]\nclass = 0", fillcolor="#eeab7b"] ;
|
||||
92 -> 93 ;
|
||||
94 [label="entropy = 0.0\nsamples = 1\nvalue = [0, 1]\nclass = 1", fillcolor="#399de5"] ;
|
||||
93 -> 94 ;
|
||||
95 [label="entropy = 0.0\nsamples = 3\nvalue = [3, 0]\nclass = 0", fillcolor="#e58139"] ;
|
||||
93 -> 95 ;
|
||||
96 [label="entropy = 0.0\nsamples = 5\nvalue = [0, 5]\nclass = 1", fillcolor="#399de5"] ;
|
||||
92 -> 96 ;
|
||||
}
|
BIN
DecisionTree/Source.gv.pdf
Normal file
BIN
DecisionTree/Source.gv.pdf
Normal file
Binary file not shown.
201
DecisionTree/dane.csv
Normal file
201
DecisionTree/dane.csv
Normal file
@ -0,0 +1,201 @@
|
||||
wielkosc,"waga,",priorytet,ksztalt,kruchosc,dolna,gorna,g > d,polka
|
||||
1,0,0,1,0,0,1,0,1
|
||||
0,0,1,0,1,1,0,1,1
|
||||
2,0,1,1,0,0,0,1,0
|
||||
2,2,1,0,1,1,1,0,0
|
||||
1,0,0,1,0,0,0,1,1
|
||||
2,1,0,0,1,1,0,0,0
|
||||
1,0,0,0,1,0,0,1,1
|
||||
1,1,0,1,0,0,0,1,1
|
||||
0,0,1,0,1,1,1,0,1
|
||||
0,2,0,0,0,1,1,0,0
|
||||
0,0,1,0,0,1,0,1,1
|
||||
0,0,0,0,0,1,1,0,1
|
||||
0,2,1,0,1,1,0,0,0
|
||||
2,0,0,0,1,0,0,0,1
|
||||
2,1,0,1,0,1,1,1,0
|
||||
0,1,1,0,1,1,1,0,0
|
||||
0,2,0,1,1,1,0,1,1
|
||||
1,2,1,0,1,1,0,0,0
|
||||
0,0,1,1,1,1,0,1,1
|
||||
0,0,0,1,1,0,0,1,1
|
||||
1,1,1,1,1,0,1,0,0
|
||||
1,2,1,0,0,1,1,1,1
|
||||
2,2,1,1,0,1,1,1,0
|
||||
1,2,1,0,1,1,0,1,1
|
||||
0,1,0,0,0,1,0,1,1
|
||||
1,1,0,0,0,1,0,1,1
|
||||
0,1,0,0,0,1,1,1,1
|
||||
2,1,0,1,0,1,0,1,0
|
||||
0,1,1,0,1,1,0,0,0
|
||||
2,1,0,1,0,1,1,0,0
|
||||
1,2,1,0,0,0,1,1,1
|
||||
1,2,0,1,0,1,1,1,1
|
||||
0,2,0,1,0,1,0,1,0
|
||||
2,1,1,0,1,1,1,1,1
|
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0,0,1,1
|
||||
2,2,0,0,0,1,0,1,0
|
||||
0,1,1,0,0,0,1,0,0
|
||||
0,2,0,0,1,0,1,0,1
|
||||
1,1,0,0,1,1,1,1,1
|
||||
0,0,0,1,0,0,1,1,1
|
||||
0,1,1,0,0,1,1,1,1
|
||||
2,2,0,1,1,0,1,0,0
|
||||
1,0,1,0,1,0,1,1,1
|
||||
1,1,0,1,0,0,1,1,1
|
||||
2,0,1,1,0,0,1,0,0
|
||||
2,0,1,0,0,0,1,0,0
|
||||
1,1,1,1,0,1,1,1,0
|
||||
2,1,1,0,1,0,0,0,0
|
||||
0,2,0,1,1,0,0,0,0
|
||||
1,2,1,1,0,1,0,0,0
|
||||
2,1,1,1,1,1,0,1,0
|
||||
0,2,0,1,0,1,1,1,1
|
||||
0,2,1,0,1,0,0,1,1
|
||||
0,1,1,0,0,0,1,1,1
|
||||
1,0,0,1,1,0,1,1,1
|
||||
2,2,1,1,0,0,0,0,0
|
||||
0,1,1,0,0,0,0,0,0
|
||||
2,0,1,1,0,1,0,0,0
|
||||
0,1,1,0,0,0,0,1,1
|
||||
0,0,1,1,1,0,1,0,1
|
||||
0,2,0,0,0,0,1,0,1
|
||||
2,0,0,1,0,1,1,0,0
|
||||
0,0,1,0,1,0,1,1,1
|
||||
2,2,0,0,1,0,1,1,1
|
||||
2,2,0,1,0,0,0,1,0
|
||||
2,2,0,1,0,1,0,1,0
|
||||
1,2,1,0,0,1,0,1,0
|
|
57
DecisionTree/drzewo_decyzyjne.py
Normal file
57
DecisionTree/drzewo_decyzyjne.py
Normal file
@ -0,0 +1,57 @@
|
||||
import graphviz
|
||||
import pandas as pd
|
||||
from sklearn.tree import DecisionTreeClassifier
|
||||
from sklearn.tree import export_graphviz
|
||||
|
||||
plikZPrzecinkami = open("training_data.txt", 'w')
|
||||
|
||||
with open('200permutations_table.txt', 'r') as plik:
|
||||
for linia in plik:
|
||||
liczby = linia.strip()
|
||||
wiersz = ""
|
||||
licznik = 0
|
||||
for liczba in liczby:
|
||||
wiersz += liczba
|
||||
wiersz += ";"
|
||||
wiersz = wiersz[:-1]
|
||||
wiersz += '\n'
|
||||
plikZPrzecinkami.write(wiersz)
|
||||
|
||||
plikZPrzecinkami.close()
|
||||
|
||||
x = pd.read_csv('training_data.txt', delimiter=';',
|
||||
names=['wielkosc', 'waga,', 'priorytet', 'ksztalt', 'kruchosc', 'dolna', 'gorna', 'g > d'])
|
||||
y = pd.read_csv('decisions.txt', names=['polka'])
|
||||
# X_train, X_test, y_train, y_test = train_test_split(x, y, test_size=0.3, random_state=1) # 70% treningowe and 30% testowe
|
||||
|
||||
# Tworzenie instancji klasyfikatora ID3
|
||||
clf = DecisionTreeClassifier(criterion='entropy')
|
||||
|
||||
# Trenowanie klasyfikatora
|
||||
clf.fit(x.values, y.values)
|
||||
# clf.fit(X_train, y_train)
|
||||
|
||||
|
||||
# Predykcja na nowych danych
|
||||
new_data = [[2, 2, 1, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]
|
||||
predictions = clf.predict(new_data)
|
||||
# y_pred = clf.predict(X_test)
|
||||
|
||||
|
||||
print(predictions)
|
||||
# print("Accuracy:", clf.score(new_data, predictions))
|
||||
# print("Accuracy:", metrics.accuracy_score(y_test, y_pred))
|
||||
|
||||
|
||||
# Wygenerowanie pliku .dot reprezentującego drzewo
|
||||
dot_data = export_graphviz(clf, out_file=None, feature_names=list(x.columns), class_names=['0', '1'], filled=True,
|
||||
rounded=True)
|
||||
|
||||
# Tworzenie obiektu graphviz z pliku .dot
|
||||
graph = graphviz.Source(dot_data)
|
||||
|
||||
# Wyświetlanie drzewa
|
||||
graph.view()
|
||||
|
||||
z = pd.concat([x, y], axis=1)
|
||||
z.to_csv('dane.csv', index=False)
|
200
DecisionTree/training_data.txt
Normal file
200
DecisionTree/training_data.txt
Normal file
@ -0,0 +1,200 @@
|
||||
1;0;0;1;0;0;1;0
|
||||
0;0;1;0;1;1;0;1
|
||||
2;0;1;1;0;0;0;1
|
||||
2;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;0;1;0;1;0;1
|
||||
1;2;1;0;0;1;0;1
|
Loading…
Reference in New Issue
Block a user