Update
This commit is contained in:
parent
9455e783a4
commit
3c8dc84f7b
57
raport.md
57
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
|
||||
|
Loading…
Reference in New Issue
Block a user