From 3c8dc84f7b8409ca1a7171e58311d2bb22340a05 Mon Sep 17 00:00:00 2001 From: Serhii Hromov Date: Mon, 18 May 2020 14:38:44 +0000 Subject: [PATCH] Update --- raport.md | 57 +++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 45 insertions(+), 12 deletions(-) diff --git a/raport.md b/raport.md index 51782e6..0d195e9 100644 --- a/raport.md +++ b/raport.md @@ -23,6 +23,7 @@ Potrawy, ich nazwa, rodzaj oraz charakterystyka. Dane uczące: + training_data = [ ['meat','hot','Pork'], ['salad','cold','Greek Salad'], @@ -30,30 +31,62 @@ Dane uczące: ['drink','hot','Latte'], ['drink','cold','Green Tea'], ['meal','hot','Pizza'], + ['meal','cold','Wheat Pita'], ] -Dane testowe: - test_data = [ - ['meat','hot','Latte'], - ['salad','hot','Greek Salad'], - ['drink','hot','Pork'], - ['drink','cold','Green Tea'], - ['drink','hot','Greek Salad'], - ] +Dane testowe jest tworzone losowo w funkcji: + + def client_ordering(): + order = [] + + dish = uniq_val_from_data(training_data, 0) + temperature = uniq_val_from_data(training_data, 1) + + tmpr = random.sample(dish, 1) + order.append(tmpr[0]) + + tmpr = random.sample(temperature, 1) + order.append(tmpr[0]) + order.append('order') + return order + ### Implementacja -Główna część: +####Drzewo: - In process +Klasy: - ... - +#####Question + class Queestion: + def __init__(self, col, value): + self.col = col #column + self.value = value #value of column + + def compare(self, example): + #compare val in example with val in the question + + def __repr__(self): + #just to print + +#####Node + class Decision_Node(): + #contain the question and child nodes + def __init__(self, quest, t_branch, f_branch): + self.quest = quest + self.t_branch = t_branch + self.f_branch = f_branch + +#####Leaf + class Leaf: + #contain a number of how many times the label has appeared in dataset + def __init__(self, rows): + self.predicts = uniq_count(rows) ### Biblioteki