Algorytm_genetyczny #3

Merged
s481832 merged 18 commits from Algorytm_genetyczny into master 2024-06-10 13:30:20 +02:00
10 changed files with 20 additions and 22 deletions
Showing only changes of commit dbdb7b6b7d - Show all commits

View File

@ -16,7 +16,7 @@ class Bat(Animal):
def getting_hungry(self, const):
checktime = datetime.now()
delta = checktime - self._starttime
minutes_passed = delta.total_seconds() / 35*5
minutes_passed = delta.total_seconds() / (25)
self._starttime = checktime
if const.IS_NIGHT and self._feed < 10:

View File

@ -18,7 +18,7 @@ class Bear(Animal):
checktime = datetime.now()
delta = checktime - self._starttime
minutes_passed = delta.total_seconds() / 60*5
minutes_passed = delta.total_seconds() / (45)
self._starttime = checktime
if const.IS_NIGHT and self._feed < 10 and const.season != "winter":

View File

@ -22,7 +22,7 @@ class Elephant(Animal):
def getting_hungry(self, const):
checktime = datetime.now()
delta = checktime - self._starttime
minutes_passed = delta.total_seconds() / 50*5
minutes_passed = delta.total_seconds() / (90)
self._starttime = checktime
if not const.IS_NIGHT and self._feed < 10:

View File

@ -17,7 +17,7 @@ class Giraffe(Animal):
def getting_hungry(self, const):
checktime = datetime.now()
delta = checktime - self._starttime
minutes_passed = delta.total_seconds() / 35*5
minutes_passed = delta.total_seconds() / (60)
self._starttime = checktime
if not const.IS_NIGHT and self._feed < 10:

View File

@ -16,7 +16,7 @@ class Owl(Animal):
def getting_hungry(self, const):
checktime = datetime.now()
delta = checktime - self._starttime
minutes_passed = delta.total_seconds() / 30*5
minutes_passed = delta.total_seconds() / (50)
self._starttime = checktime
if const.IS_NIGHT and self._feed < 10:

View File

@ -17,7 +17,7 @@ class Parrot(Animal):
def getting_hungry(self, const):
checktime = datetime.now()
delta = checktime - self._starttime
minutes_passed = delta.total_seconds() / 25*5
minutes_passed = delta.total_seconds() / (30)
self._starttime = checktime
if not const.IS_NIGHT and self._feed < 10:

View File

@ -17,7 +17,7 @@ class Penguin(Animal):
def getting_hungry(self, const):
checktime = datetime.now()
delta = checktime - self._starttime
minutes_passed = delta.total_seconds() / 20*5
minutes_passed = delta.total_seconds() / (25)
self._starttime = checktime
if not const.IS_NIGHT and self._feed < 10:

View File

@ -9,7 +9,7 @@ False,True,False,summer,2,9.07977,22.08011,20.53507,3
False,False,True,winter,11,3.5635,14.75823,43.46342,2
False,False,True,winter,9,8.03113,20.6384,30.81177,2
True,True,True,summer,0,0.01966,28.27203,3.37575,1
False,False,False,autumn,12,8.27518,5.91931,21.10505,3
False,False,False,autumn,12,8.27518,5.91931,1.10505,2
False,False,True,summer,1,5.058,11.01892,48.04589,3
False,True,False,winter,9,5.64777,17.19678,12.20864,1
True,True,True,summer,0,6.86046,19.03315,47.13198,3
@ -49,7 +49,7 @@ False,False,True,autumn,5,7.85569,40.47073,49.75818,2
True,False,True,summer,1,9.03492,23.44692,20.0026,3
False,True,True,autumn,8,2.36724,42.81768,21.34668,2
False,False,True,summer,15,6.8222,15.2733,15.14799,3
True,False,True,summer,4,8.63882,41.36166,17.98981,3
True,False,True,summer,4,8.63882,41.36166,7.98981,2
False,True,False,autumn,12,0.48943,8.67832,40.4952,1
False,False,False,autumn,3,3.0489,14.81219,8.32707,1
False,True,True,winter,6,0.41014,49.94757,12.61713,1
@ -73,7 +73,7 @@ False,False,False,summer,3,7.36268,28.50462,29.52973,1
True,True,True,spring,3,6.1319,37.71758,33.50616,1
False,True,True,spring,0,0.77228,42.89976,19.19004,1
True,False,True,autumn,3,7.73055,20.87865,37.18248,1
False,False,False,summer,1,8.30392,34.47046,34.77926,3
False,False,False,summer,1,8.30392,34.47046,8.77926,2
True,True,False,summer,8,2.96562,17.50839,23.22476,1
True,True,True,winter,4,2.27279,20.58575,32.17293,1
True,False,True,spring,7,6.14608,34.46015,17.22245,1

1 adult active_time ill season guests hunger wet_food dry_food decision
2 True True True spring 12 4.0462 37.63803 5.60819 2
3 True False False spring 9 2.89229 34.37597 27.75948 1
4 False True True summer 15 2.4002 45.06447 41.50999 3
5 True False False summer 5 0.73248 46.1058 33.44281 1
6 True False False summer 12 0.62973 49.99647 41.07699 1
7 True False False winter 9 7.0889 46.16796 45.904 2
8 False True False summer 2 9.07977 22.08011 20.53507 3
9 False False True winter 11 3.5635 14.75823 43.46342 2
10 False False True winter 9 8.03113 20.6384 30.81177 2
11 True True True summer 0 0.01966 28.27203 3.37575 1
12 False False False autumn 12 8.27518 5.91931 1.10505 2
13 False False True summer 1 5.058 11.01892 48.04589 3
14 False True False winter 9 5.64777 17.19678 12.20864 1
15 True True True summer 0 6.86046 19.03315 47.13198 3
16 True False True winter 13 0.42516 12.62312 19.15853 1
17 True False True summer 14 4.46951 33.59537 47.343 1
18 True True False autumn 11 6.49386 0.64398 1.0515 1
19 False False False winter 10 1.9354 22.80015 26.01165 1
20 True False False summer 7 3.55716 1.91094 41.82462 1
21 False True True winter 8 9.01072 15.89341 9.10422 2
22 False True True spring 4 4.64513 10.39766 7.57955 2
23 True False False autumn 2 4.11019 45.85039 30.34183 1
24 True True True spring 8 7.09003 6.92577 24.77301 3
25 True True False spring 6 4.12955 47.91516 12.84722 1
26 True True True spring 10 2.70845 1.0623 42.6941 3
27 True True True spring 15 4.34025 6.89381 3.03923 2
28 True False False autumn 5 7.24464 31.34759 6.44719 1
29 True True True summer 6 3.8924 18.08964 18.77435 1
30 False False True spring 13 4.86962 48.62578 6.05301 2
31 False True False spring 11 1.60186 31.34926 14.41007 2
32 False True False autumn 2 4.19839 19.58116 28.63919 1
33 False True True autumn 6 1.50346 25.88282 24.97486 1
34 False True False spring 7 2.67431 17.05587 24.7939 1
35 True True True spring 7 1.72828 38.17304 24.3685 1
36 False True True summer 12 7.55322 26.52797 42.24754 3
37 False True False summer 5 8.74993 30.39317 4.5676 2
38 False True False summer 5 7.42862 48.73014 5.94891 2
39 True False False spring 4 9.3662 12.90556 41.31266 3
40 False True False autumn 8 4.72785 0.1623 19.48377 1
41 False False False winter 14 6.49349 29.52121 21.87192 1
42 True False False summer 14 1.57899 26.90783 33.03528 1
43 False True False summer 3 6.21725 3.60564 23.51978 1
44 True True True winter 4 4.18565 25.24209 11.02056 1
45 False False True autumn 8 6.5479 39.16107 4.75438 2
46 False False False summer 13 2.14609 39.97177 13.98651 1
47 True True False winter 9 7.43651 10.09353 15.70939 3
48 False False True autumn 5 7.85569 40.47073 49.75818 2
49 True False True summer 1 9.03492 23.44692 20.0026 3
50 False True True autumn 8 2.36724 42.81768 21.34668 2
51 False False True summer 15 6.8222 15.2733 15.14799 3
52 True False True summer 4 8.63882 41.36166 7.98981 2
53 False True False autumn 12 0.48943 8.67832 40.4952 1
54 False False False autumn 3 3.0489 14.81219 8.32707 1
55 False True True winter 6 0.41014 49.94757 12.61713 1
56 True False True winter 12 5.55017 0.98544 10.25287 1
57 True False False summer 11 9.92135 6.80759 48.0665 3
58 False True True winter 2 7.14394 11.41862 18.29288 2
59 False True True winter 10 1.39924 36.41807 42.95548 2
60 False True False summer 1 0.95193 46.53851 25.70391 1
61 False True False winter 4 1.44658 6.61497 31.58116 1
62 False True False autumn 10 7.9404 26.82316 49.5898 2
63 True False False spring 5 5.14951 32.36345 11.32114 1
64 True True False summer 5 7.55665 49.12578 29.32983 3
65 True False True autumn 3 3.80646 11.86722 35.43034 1
66 False False False winter 12 3.65822 0.14026 19.18031 1
67 True False False spring 8 8.58384 46.33595 11.52974 2
68 True False False summer 3 6.34127 22.66891 19.15813 1
69 False True False spring 13 7.86448 8.85557 40.03913 3
70 True True False spring 13 8.89316 49.89548 21.04525 2
71 True True False autumn 9 0.91339 36.35922 16.09576 1
72 False False False summer 3 7.36268 28.50462 29.52973 1
73 True True True spring 3 6.1319 37.71758 33.50616 1
74 False True True spring 0 0.77228 42.89976 19.19004 1
75 True False True autumn 3 7.73055 20.87865 37.18248 1
76 False False False summer 1 8.30392 34.47046 8.77926 2
77 True True False summer 8 2.96562 17.50839 23.22476 1
78 True True True winter 4 2.27279 20.58575 32.17293 1
79 True False True spring 7 6.14608 34.46015 17.22245 1
80 False False True winter 1 8.32044 12.09058 37.28732 3
81 False True False spring 14 9.56618 48.49473 46.37651 2
82 True False True spring 10 9.33146 47.99213 35.92519 2
83 False True False spring 6 0.47396 37.45415 36.87019 1
84 True False False summer 12 7.61463 4.36339 36.07375 3
85 True True True autumn 3 6.42039 4.90383 43.29857 3
86 False True False winter 13 6.89007 43.09184 3.04284 2
87 True False True winter 1 6.56604 19.04681 27.58314 2
88 True False True spring 3 1.96784 2.18597 34.02966 1
89 False False False spring 0 3.76673 1.64674 34.50649 1
90 False False True summer 2 0.05382 10.48896 24.03557 1
91 True False True spring 14 5.12387 44.44585 8.35502 3
92 True True False autumn 10 4.90335 43.27857 27.22901 1
93 True False False winter 11 5.89082 28.91495 15.58095 1
94 True False True autumn 3 7.39589 21.53402 44.50694 3
95 True False True autumn 3 7.39589 21.53402 0.00000 2
96 True False False summer 12 5.68671 49.18777 22.53807 3
97 False False False winter 0 0.86765 41.28704 33.77284 1
98 False False True summer 10 5.97643 36.23669 48.32615 2
99 False True True autumn 7 1.76947 38.34692 13.28679 1
100 True True True summer 13 8.63622 16.14861 44.91355 3
101 True False False winter 11 8.48481 37.52722 47.76888 2
102 True True True summer 12 7.65812 4.16785 34.57922 3
103 False False True winter 7 8.44897 42.99815 44.66558 2
104 False False False winter 7 0.53067 13.47003 18.45329 1
105 False False False winter 14 3.24747 9.51144 6.62824 1
106 True True False spring 12 5.19071 47.53107 34.68942 2
107 True False False summer 9 6.9442 46.79146 13.92798 2
108 True False False autumn 1 3.09242 18.02023 11.03004 1
109 True True True spring 3 0.19271 1.00203 1.16671 1
110 False True True winter 5 9.00758 37.95091 11.54697 2
111 True False True spring 9 6.11904 37.42698 4.82627 2
112 False False True autumn 9 6.29507 22.99044 15.46992 2
113 False False False winter 13 5.4099 11.75134 6.91861 1
114 False False False winter 5 9.92035 21.82547 10.2415 2
115 False True False winter 10 6.06913 1.46795 12.76663 1
116 True False True spring 5 8.1218 37.03643 32.04156 3
117 True False False autumn 11 0.48844 39.36689 0.03464 1
118 False True True summer 6 1.72816 26.85829 16.53262 1
119 False False False spring 5 6.04025 29.55673 18.85232 2
120 False True True winter 2 1.75157 0.6601 49.91163 1
121 False True True winter 9 6.75125 15.22221 6.72688 2
122 False True True autumn 9 6.72535 24.07403 33.94074 2
123 False False False winter 14 0.02843 48.49973 15.81701 1
124 False False True autumn 15 1.07944 45.94025 4.05257 1
125 False False True winter 12 7.26288 15.82501 22.56163 2
126 True True True winter 11 8.50892 23.89966 46.14267 3
127 True False True autumn 11 8.10923 24.31448 6.70919 2
128 True True False summer 11 4.65313 3.44791 3.96313 3
129 True False True summer 2 2.56716 10.85536 49.88738 1
130 False False True autumn 4 8.19265 5.43942 48.74041 3
131 False True False autumn 5 5.6574 9.75738 25.96888 3
132 False True False autumn 5 5.6574 9.75738 0.00000 2
133 False True False winter 14 4.87066 33.40134 18.98246 2
134 True True True winter 6 8.2623 37.47298 33.76759 2
135 True True True spring 10 2.20409 13.6178 5.80078 2
136 True False True autumn 7 9.06057 37.8724 23.62209 2
137 False False True autumn 3 6.69861 37.07336 16.87187 2
138 False False True autumn 3 6.69861 0.00000 16.87187 3
139 True False True autumn 13 4.96475 46.87852 3.1412 1
140 True False True autumn 9 2.65212 19.06994 37.33364 1
141 True True False summer 15 3.47148 35.84529 0.00000 1
142 False True True summer 8 1.51025 9.44246 19.05913 1
143 False False True autumn 6 6.48485 45.61986 15.91179 2
144 False False False spring 2 8.98075 39.32941 42.47669 2
145 False True True winter 5 8.37177 12.99299 42.31566 3
146 True True True autumn 6 3.38746 48.86975 49.62605 1
147 False True True summer 7 7.09358 22.83074 38.5172 2
148 False False True spring 9 1.00148 11.16064 0.52706 1
149 False False True winter 1 6.08476 37.67744 4.49812 2
150 False True False spring 5 4.5182 32.48803 33.44274 1
151 True True True summer 8 6.11265 30.32015 46.47287 3
152 False True True winter 4 8.50937 22.72015 0.00000 2
153 True False True summer 4 7.23924 39.09963 42.82872 3
154 False False True summer 5 1.28353 7.18667 38.93923 1
155 False True False spring 3 4.50329 22.95269 0.41795 1
156 True True True summer 1 0.47824 14.79432 24.64273 1
157 False True False spring 10 8.43205 19.1333 20.95803 2
158 False True False spring 6 9.94659 18.83814 39.26147 2
159 False True False spring 3 3.68802 1.58951 26.4255 1
160 False False True autumn 8 4.79336 22.56564 4.95207 2
161 False True True spring 10 1.63541 0.00000 31.82704 1
162 False True False spring 2 1.2274 47.87731 32.98744 1
163 True True False winter 11 7.31457 26.08142 16.5835 2
164 False True True summer 2 4.90627 19.73976 49.56272 3
165 True True False winter 8 3.02707 35.9547 29.52088 1
166 True True True summer 7 5.02577 5.37674 16.61368 3
167 False False True spring 8 9.58805 8.12549 0.00000 2
168 False True True summer 6 2.08786 37.11126 36.15777 3
169 True True False spring 7 8.11839 12.2032 8.26737 2
170 True False True summer 7 4.08923 20.77025 11.25944 1
171 False False True winter 4 4.85557 0.00000 39.4493 2
172 False False False summer 14 9.12718 41.84025 49.51895 2
173 True True True summer 15 9.4014 34.10345 26.84361 3
174 False True False spring 14 8.61728 28.58017 39.3705 2
175 False True False winter 8 7.12808 12.04193 43.86622 2
176 True False True winter 1 9.50102 43.46168 28.81571 2
177 True True False spring 5 1.35366 6.95688 33.37058 1
178 False False True autumn 11 7.61014 11.10761 41.58039 2
179 False True True summer 2 6.86814 37.72905 14.64706 3
180 True False False winter 1 8.12812 22.55081 9.43532 2
181 True True True winter 10 4.18282 27.82423 30.42216 1
182 False False False summer 7 2.52646 3.74242 10.61286 1
183 False False True spring 13 3.15065 19.01632 34.56097 2
184 True True False summer 3 0.18108 46.67684 46.76693 1
185 True True True spring 0 1.50217 5.27541 16.18378 1
186 False True True summer 5 3.71758 11.15496 12.57224 3
187 False True False summer 6 9.92613 8.59078 21.32207 3
188 True False False winter 11 0.1261 2.42716 17.23296 1
189 True False True summer 14 6.90049 10.76539 3.92394 3
190 False True True autumn 15 1.76164 35.60051 2.5168 2
191 False False True spring 11 2.39225 36.14198 9.13906 3
192 True True False summer 2 4.04026 0.00000 12.47216 1
193 True True False spring 13 3.32803 7.59913 1.89442 3
194 True False True spring 1 5.15927 44.02139 4.03454 1
195 True True True autumn 13 5.52565 7.75133 38.62709 3
196 True True False spring 3 8.44216 30.01593 12.45777 3
197 False False True summer 13 2.88557 5.18905 5.87065 3
198 True True True spring 11 2.45261 7.22671 49.68806 3
199 True True True winter 4 8.55814 3.29899 32.82852 2
200 False False True summer 4 9.85169 47.62867 17.3155 3
201 False False True winter 2 5.30151 26.50068 48.79306 2
202 False False False autumn 9 7.59806 0.00000 36.92142 2
203 False True True autumn 1 9.28424 17.58014 28.42461 2
204 True False True summer 14 7.82306 35.29264 46.36975 3
205 False False True winter 2 1.10909 46.37088 40.88245 1
206 True True False summer 1 7.71442 43.2301 27.42849 3
207 False True True summer 6 1.21255 3.7357 4.31858 1
208 True True True winter 8 9.53076 12.54774 17.63524 2
209 True True True autumn 3 8.47955 19.04656 3.62988 2
210 True False True winter 3 2.58264 28.29242 0.00000 1
211 True False False autumn 5 6.83145 0.00000 15.88102 1
212 True False False summer 10 3.24742 16.50963 26.24036 1
213 False False False summer 8 8.66174 49.55046 33.2433 2
214 True False True winter 7 1.40722 4.06585 2.57929 1
215 False True False winter 12 4.483 2.42211 20.55941 2
216 False False True spring 12 2.98512 30.55243 5.53733 3
217 False False True autumn 6 0.84086 33.57311 32.42908 1
218 False True True winter 12 1.07916 8.27438 7.9284 1
219 False False True spring 12 3.17402 46.59657 14.21739 3
220 False True True winter 11 7.09559 14.18261 43.41709 2
221 False False True autumn 3 0.53006 21.37664 17.14295 1
222 False False False autumn 14 4.67143 4.11788 0.04226 1
223 True False True winter 12 3.48493 35.24303 0.00000 1
224 True True True spring 9 5.1789 0.97673 8.31413 2
225 False False False spring 5 1.50319 28.57762 27.80054 1
226 True True True autumn 10 9.23444 43.51842 19.90954 2
227 False False False autumn 9 3.84582 40.34953 9.01663 1
228 True True False winter 5 3.90587 32.97826 0.67046 1
229 True True True autumn 2 9.19994 0.00000 34.36662 3
230 False True True summer 6 5.614 29.08038 0.00000 2
231 True True True autumn 2 2.15339 6.36751 6.45082 1
232 True False True spring 1 9.19416 32.05433 8.27667 2
233 True False True autumn 0 8.12282 48.68677 8.38304 2
234 False True True spring 12 3.26729 29.61584 1.69993 2
235 True False True summer 8 1.99886 31.26437 3.51834 1
236 False False True summer 7 7.41314 44.88982 34.46453 2
237 True False True summer 0 7.24464 8.85289 34.29828 3
238 False True False summer 8 2.38628 21.76861 47.20283 3
239 True True True autumn 3 7.12112 12.08359 41.06062 3
240 True False False winter 5 6.74504 47.09367 1.97357 2
241 False False False summer 8 1.23539 35.47945 7.67276 1
242 True False False spring 11 7.91742 34.52557 30.96412 3
243 False True True winter 14 5.91181 7.53226 16.37669 3
244 False True True spring 13 6.07261 47.43572 15.83885 2
245 True True True autumn 2 9.22518 31.25996 28.06488 3
246 False True True summer 3 8.47609 0.23934 31.25786 3
247 False True False autumn 6 0.97126 13.65648 25.59887 1
248 True False False spring 14 9.29029 46.83676 12.58912 2
249 False False False winter 14 0.14092 4.6673 20.3859 1
250 True False True autumn 2 3.52708 37.61372 32.83573 1
251 True True True winter 1 4.37134 43.19138 22.04785 1
252 True False True summer 9 1.1614 10.9739 42.3009 1
253 False False False winter 9 7.27324 29.74731 47.17759 2
254 False True True winter 9 3.17153 35.14715 21.37868 2
255 False True False autumn 0 2.37863 20.35733 46.96943 1
256 False False True autumn 4 0.70656 8.70201 5.26527 1
257 True True True winter 1 8.23562 36.01552 25.03969 2
258 True True False winter 3 6.65062 6.75622 24.91086 3
259 False False False spring 10 2.30179 19.62758 25.57147 1
260 True True False autumn 10 6.60812 6.61336 12.39931 3
261 False False True summer 3 8.9948 47.39225 18.11157 2
262 True False True autumn 5 6.69302 42.62701 13.01677 2
263 False False False spring 14 8.53868 33.42545 2.43572 2
264 False True True autumn 10 4.46205 10.37542 39.58137 3
265 True True False spring 14 5.34262 15.45545 21.48404 3
266 True False False winter 9 7.02885 4.88308 27.56619 3
267 False False False autumn 13 3.55279 0.17091 5.43831 1
268 True True True autumn 1 9.98637 27.57982 15.82173 2
269 False True True summer 9 8.25408 13.10493 27.07596 3
270 False False False spring 15 1.9089 33.25115 44.57492 1
271 True False False autumn 12 6.65534 38.00972 20.31047 2
272 False True True autumn 1 0.01592 6.24929 15.51308 1
273 False True True winter 13 1.24017 36.88006 16.50894 1
274 False True True winter 13 6.1878 15.18876 9.02381 2
275 True True True winter 5 5.45157 13.27868 39.39805 2
276 True False True spring 5 2.82881 28.62319 24.03077 1
277 False False True spring 2 4.8246 41.45269 48.89539 2
278 True False False spring 8 9.3343 39.02018 45.01066 3
279 True True True autumn 4 1.8456 2.94366 37.44996 1
280 False True True summer 14 0.95333 4.57964 26.37633 1
281 False False True autumn 13 9.84087 24.03819 41.72097 2
282 True False False autumn 9 3.70617 32.70115 1.69105 1
283 True True True spring 12 6.77783 6.67976 20.46179 3
284 False False True summer 15 7.15829 31.24546 10.37666 3
285 False True True summer 1 2.28393 18.13299 34.38756 3
286 True False True autumn 7 3.96302 39.84093 47.0172 1
287 True False False summer 1 0.65085 20.20581 14.96995 1
288 True False False winter 2 9.24331 26.34543 30.5147 2
289 True False False summer 3 2.86309 15.56342 1.04324 1
290 True True True autumn 8 5.71809 24.41045 48.78273 2
291 True True True autumn 8 5.71809 24.41045 48.78273 2
292 True True True winter 8 5.71809 0.99999 48.78273 3
293 True True True winter 8 5.71809 1.98675 48.79993 3
294 True True False winter 8 7.71809 1.02345 38.78273 3
295 True False False summer 1 4.03947 33.84073 6.48891 1
296 True False False winter 4 2.46471 24.07929 17.77792 1
297 False False False winter 9 3.66415 23.68306 24.43865 1
298 True True True autumn 8 5.71809 24.41045 48.78273 2
299 False True True spring 3 5.3009 34.83862 6.75862 2
300 True False True winter 8 6.23275 8.1183 19.6922 3
301 False True True autumn 2 4.21016 11.24334 34.98395 3
302 True True False autumn 0 2.79424 13.25106 5.69617 1
303 True True False winter 15 2.43843 14.61703 49.57393 2
304 True True True summer 8 2.28654 20.9895 5.64007 1
305 False False False autumn 1 2.5607 26.85209 47.10784 1
306 True True True winter 14 1.56638 18.02703 7.05011 1
307 False False False winter 13 3.86632 28.9884 20.1928 1
308 True False False summer 13 6.37654 34.3833 34.53892 3
309 True False False summer 13 6.37654 34.3833 34.53892 3
310 True False False spring 11 8.35634 0.00000 34.53892 3
311 True False True summer 13 9.37654 34.3833 0.00000 2
312 True False False winter 13 7.77754 34.3833 0.00000 2
313 True True True summer 5 8.10422 7.6617 23.41017 3

View File

@ -1,5 +1,5 @@
import pandas as pd
from sklearn.tree import DecisionTreeClassifier, plot_tree, export_graphviz
from sklearn.tree import DecisionTreeClassifier, plot_tree
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
import matplotlib.pyplot as plt
@ -9,24 +9,22 @@ data = pd.read_csv('dane.csv', header=0)
X = data[headers]
Y = data['decision']
X = pd.get_dummies(data=X, columns=['season'])
clf = DecisionTreeClassifier(random_state=0, min_samples_leaf = 4, min_samples_split=2)
clf = clf.fit(X,Y)
#skuteczność drzewa
'''
X_train, X_test, Y_train, Y_test = train_test_split(X, Y, train_size=0.8)
clf = clf.fit(X_train, Y_train)
Y_pred = clf.predict(X_test)
accuracy = accuracy_score(Y_test, Y_pred)
clf = DecisionTreeClassifier(max_depth=6)
X1, X2, Y1, Y2 = train_test_split(X, Y, train_size=0.8)
clf = clf.fit(X1, Y1)
pred = clf.predict(X2)
accuracy = accuracy_score(Y2, pred)
print("Dokładność:", accuracy)
'''
#zapisanie drzewa do pliku
plt.figure(figsize=(50,30))
plot_tree(clf, filled=True, feature_names=X.columns, class_names=['nie karmi', 'karmi mokrą karmą', 'karmi suchą karmą'])
plot_tree(clf, filled=True, feature_names=X.columns.tolist(), class_names=['nie karmi', 'karmi mokrą karmą', 'karmi suchą karmą'])
plt.savefig('tree.png')
# dane do decyzji
def feed_decision(adult,active_time,ill,season,guests,hunger,dry_food,wet_food):
X_new = pd.DataFrame({
'adult': [adult],
'active_time': [active_time],

BIN
tree.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 613 KiB