AI-2020/raport.md

77 lines
1.7 KiB
Markdown
Raw Normal View History

2020-05-11 15:58:47 +02:00
# Podprojekt Szi
### Opis
2020-05-18 14:50:27 +02:00
Tematem podprojektu jest rozpoznawanie zamówień na podstawie historii zamówień.
Użyłem drzew decyzyjnych.
2020-05-11 15:58:47 +02:00
### Dane
2020-05-18 14:50:27 +02:00
Potrawy, ich nazwa, rodzaj oraz charakterystyka.
2020-05-11 15:58:47 +02:00
2020-05-25 16:11:16 +02:00
tree_format = ["dish", "served", "price", "origin", "cooked", "ingredients", "name"]
2020-05-18 14:50:27 +02:00
Dane uczące:
2020-05-18 16:38:44 +02:00
2020-05-25 16:11:16 +02:00
dish - (salad/soup/meal/coffee/tea/non-alcho drink)
served - (cold/hot/warm)
origin - (Worldwide/America/Europe/Asia)
cooked - (baked/boiled/mixed)
ingridients - (2/4)
2020-05-11 15:58:47 +02:00
2020-05-18 16:38:44 +02:00
Dane testowe jest tworzone losowo w funkcji:
def client_ordering():
order = []
2020-05-11 16:13:58 +02:00
2020-05-18 16:38:44 +02:00
dish = uniq_val_from_data(training_data, 0)
temperature = uniq_val_from_data(training_data, 1)
2020-05-11 16:13:58 +02:00
2020-05-18 16:38:44 +02:00
tmpr = random.sample(dish, 1)
order.append(tmpr[0])
2020-05-11 15:58:47 +02:00
2020-05-18 16:38:44 +02:00
tmpr = random.sample(temperature, 1)
order.append(tmpr[0])
order.append('order')
return order
2020-05-25 16:11:16 +02:00
2020-05-11 16:14:53 +02:00
2020-05-18 16:38:44 +02:00
### Implementacja
####Drzewo:
Klasy:
2020-05-25 16:11:16 +02:00
Klasa Question
2020-05-18 16:38:44 +02:00
#####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
2020-05-25 16:11:16 +02:00
Klasa Node
2020-05-18 16:38:44 +02:00
#####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)
2020-05-11 16:24:34 +02:00
2020-05-11 15:58:47 +02:00
### Biblioteki
* random
* numpy