This commit is contained in:
xkamikoo 2020-06-03 14:13:24 +02:00
parent ff6de2c7e4
commit adf186529c

View File

@ -187,15 +187,17 @@ class main():
self.path = path self.path = path
self.best_action = 0 self.best_action = 0
def main(self):
# tworzymy zbior uczacy, w ktorym podajemy wszystkie mozliwe pola i czynnosci # tworzymy zbior uczacy, w ktorym podajemy wszystkie mozliwe pola i czynnosci
training_data = [[0, 0, 1, 0, "Zasadzic"], training_data = [[0, 0, 1, 0, "Zasadzic"],
[0, 1, 1, 0, "Odchwascic"], [0, 1, 1, 0, "Odchwascic"],
[0, 0, 0, 0, "Podlac"], [0, 0, 0, 0, "Podlac"],
[0, 1, 0, 0, "Odchwascic"], [0, 1, 0, 0, "Odchwascic"],
#[1, 0, 1, 0, "Zasadzic"], # [1, 0, 1, 0, "Zasadzic"],
#[1, 1, 1, 0, "Odchwascic"], # [1, 1, 1, 0, "Odchwascic"],
[1, 0, 0, 0, "Czekac"], [1, 0, 0, 0, "Czekac"],
#[1, 1, 0, 0, "Odchwascic"], # [1, 1, 0, 0, "Odchwascic"],
[0, 0, 0, 1, "Zebrac"]] [0, 0, 0, 1, "Zebrac"]]
self.tree = build_tree(training_data) self.tree = build_tree(training_data)
print_tree(self.tree) print_tree(self.tree)
@ -203,14 +205,14 @@ class main():
print("------------------") print("------------------")
print("TEST:") print("TEST:")
# for i in range(len(training_data)): # for i in range(len(training_data)):
# print("Przewidziania czynnosc: %s Czynnosc: %s" # print("Przewidziania czynnosc: %s Czynnosc: %s"
# % (print_leaf(classify(translate(i), self.tree)), training_data[i][-1])) # % (print_leaf(classify(translate(i), self.tree)), training_data[i][-1]))
# if training_data[i][-1] in self.work_field(classify(translate(i), self.tree)): # if training_data[i][-1] in self.work_field(classify(translate(i), self.tree)):
# continue # continue
# else: # else:
# print("Testowanie zakonczone niepowodzeniem") # print("Testowanie zakonczone niepowodzeniem")
# break # break
print("Przewidziania czynnosc: %s Czynnosc: Zasadzic" print("Przewidziania czynnosc: %s Czynnosc: Zasadzic"
% print_leaf(classify(translate(4), self.tree))) % print_leaf(classify(translate(4), self.tree)))
@ -218,9 +220,6 @@ class main():
% print_leaf(classify(translate(5), self.tree))) % print_leaf(classify(translate(5), self.tree)))
print("Przewidziania czynnosc: %s Czynnosc: Odchwascic" print("Przewidziania czynnosc: %s Czynnosc: Odchwascic"
% print_leaf(classify(translate(7), self.tree))) % print_leaf(classify(translate(7), self.tree)))
def main(self):
for action in order: for action in order:
self.traktor.set_mode(action) self.traktor.set_mode(action)
self.search_field() self.search_field()