From d7d904a4be1d37fb7d48625c5df78a5ad8718bb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Szuszert?= Date: Thu, 12 May 2022 01:21:26 +0200 Subject: [PATCH] drzewo decyzyjne --- data.xlsx | Bin 0 -> 15005 bytes dishes.json | 57 ++++++++++++++++------ tiles.py | 135 ++++++++++++++++++++++++++++++++++++++++++++++------ 3 files changed, 164 insertions(+), 28 deletions(-) create mode 100644 data.xlsx diff --git a/data.xlsx b/data.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..810f6a73d65e3217f41c764e9b69bbcc2db321ee GIT binary patch literal 15005 zcmeIZg;yQTvObKvy9Rf6BDlLtaCh0bZpcP9?g=hIgF^zr-Q5Z9P9V73ZzuPh?>*-| z=lcup9oCvz!*o^mRM%5a?Vf5?1z0#dCxDtD{AM20FBi zNCh~0`;X|_35gS3_1>R+#v>KwA~rUTvC4o-b*b-G=at+LlP@Q+!6y*@u$8sguZ_Ld z*N9fCSNwWlsdHUfdlg%7sAL*zYZ7U|SG zzKt=PezquxDrjmRO4UB9mY{;$X&l%if}gKAeA-31@<6wNOV+bSYSEM(7jL0VMD57B zUf7>4sq$KYIVj-Ez+i)5hsv=znZHxfB;q!l)a?u2HTFT%MTa=nUi_s zYbefD7+j-~o<5WOiZ#xzLxPN3NCqYlN(1TjDZO7cyRC$t71ubf09V%wd_GJX&j_4L zE;>LL34g74G?j)w;AUpMQ0YJ5Ky`ITqNQQ;+P2y(+w~2#kFkYA$Ax4@JMNP|n{wuW zIyEoOE%&%gKi%i6K)qVtv*9eC9s%U;vVqgVpeTysRR}}Za$O1LP4z}LP23d zEaUCK;pOaVZ|3Z5|C_f8w3eLmIkAAowlAIMZ{ep!k?i#7sBBpHv}S)Q6b`{_l*3p# zPScj&pS-1~a!j9PUdrpSdbhR3lWp$i{*4j!va4V-kHpM%-K3{fvY^G6WHaOEJPN0J zx;7J=WG~oz5Ks8^^WByW`}RdX);JOrGha{R4-cCq=E3)Jv!L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wYa1LML924Z2fnCZHv7B|hIz@~6K!R&Gx4@0tF>khav#jz?~F&ZKQ8%%TOF zEL`kYD$M>N!ropIL}Z3eB~?CyEw{25#bK4E5tSySPDPNw{N2)tP%mj|6T^ny6|Ydv z2a(lrb$^C;bwk4Sfn55Bj-^ljSqG7QImc2`E(tjy`Ad~;mch8p_)l||jvve49ZxZI zoooYrQg92wQ74FDo%c4yEX|{Jn6ipASe(t zK0=p9!5+K&kqtX_VuhUc0(zUXiGfCQ6s`f=&Cs+_=Q@VCmm}OZq0y|2*>Ov-bT?66 z7ymW6K;>&T!mb+5aIQe(n)tHGQ{Bb;eTqAu$3f2k9+oNvpZ39#{TmVc7l>2-4^2YD zut6yCzi$Nm=M??(`d_vMsw(`uf`8w#^iRRx*A&Pejeps|^moC(Z{zq&v<0#^>TjDm z{x1CQ#p{2GLP5cz{1N{DDP{k=p1)T#|D}l^?f)CZf7CbsUCZA;di`G>1oC$U ze_x^bOTjV29|eD{*Zf`d@0reDqU)UhBl`Ee=kFT+ojw1Ohk_d8hJyMJF8#aszlXhl g71!kZ7x8}tK~)8K$m~Kvp+NpVKztHW@b}&S1E$=+KL7v# literal 0 HcmV?d00001 diff --git a/dishes.json b/dishes.json index dbcb916..56d0da2 100644 --- a/dishes.json +++ b/dishes.json @@ -1,36 +1,40 @@ [ { "name": "margherita", + "pos_in_card": 0, "price": 20, "spiciness": false, "vege": true, "size": 30, - "allergens": "", + "allergens": "none", "ingridients": [ "cheese" ], "drink_in": true }, { "name": "hawajska", + "pos_in_card": 1, "price": 22, "spiciness": false, "vege": false, "size": 50, - "allergens": "", + "allergens": "none", "ingridients": [ "cheese", "ham", "pineapple" ], "drink_in": true }, { "name": "funghi", + "pos_in_card": 2, "price": 22, "spiciness": false, "vege": true, "size": 30, - "allergens": "", + "allergens": "none", "ingridients": [ "cheese", "mushrooms" ], "drink_in": true }, { "name": "light", + "pos_in_card": 3, "price": 24, "spiciness": false, "vege": true, @@ -41,36 +45,40 @@ }, { "name": "4 sery", + "pos_in_card": 4, "price": 24, "spiciness": false, "vege": true, "size": 50, - "allergens": "", + "allergens": "none", "ingridients": [ "cheese", "mozzarella", "parmesan", "gorgonzola" ], "drink_in": true }, { "name": "pepperoni", + "pos_in_card": 5, "price": 25, "spiciness": true, "vege": false, "size": 50, - "allergens": "", + "allergens": "none", "ingridients": [ "cheese", "onion", "pepperoni" ], "drink_in": true }, { "name": "salami", + "pos_in_card": 6, "price": 25, "spiciness": false, "vege": false, "size": 30, - "allergens": "", + "allergens": "none", "ingridients": [ "cheese", "salami" ], "drink_in": true }, { "name": "wegetarianska", + "pos_in_card": 7, "price": 25, "spiciness": false, "vege": true, @@ -81,6 +89,7 @@ }, { "name": "barbecue", + "pos_in_card": 8, "price": 26, "spiciness": false, "vege": false, @@ -91,16 +100,18 @@ }, { "name": "miesna", + "pos_in_card": 9, "price": 27, "spiciness": false, "vege": false, "size": 30, - "allergens": "", + "allergens": "none", "ingridients": [ "cheese", "ham", "salami", "sausage", "bacon" ], "drink_in": false }, { "name": "paprykowa", + "pos_in_card": 10, "price": 27, "spiciness": true, "vege": true, @@ -111,16 +122,18 @@ }, { "name": "jalapeno", + "pos_in_card": 11, "price": 27, "spiciness": true, "vege": false, "size": 50, - "allergens": "", + "allergens": "none", "ingridients": [ "cheese", "bacon", "pepper", "onion", "jalapeno" ], "drink_in": false }, { "name": "barbecue wege", + "pos_in_card": 12, "price": 27, "spiciness": true, "vege": true, @@ -131,6 +144,7 @@ }, { "name": "kebab", + "pos_in_card": 13, "price": 32, "spiciness": false, "vege": false, @@ -141,6 +155,7 @@ }, { "name": "grecka", + "pos_in_card": 14, "price": 34, "spiciness": false, "vege": true, @@ -151,6 +166,7 @@ }, { "name": "piekielna", + "pos_in_card": 15, "price": 37, "spiciness": true, "vege": false, @@ -161,6 +177,7 @@ }, { "name": "drwala", + "pos_in_card": 16, "price": 37, "spiciness": true, "vege": false, @@ -171,6 +188,7 @@ }, { "name": "grzybowa", + "pos_in_card": 17, "price": 37, "spiciness": false, "vege": true, @@ -181,16 +199,18 @@ }, { "name": "staropolska", + "pos_in_card": 18, "price": 40, "spiciness": false, "vege": false, "size": 30, - "allergens": "", + "allergens": "none", "ingridients": [ "cheese", "chicken", "mushrooms", "sausage", "ham" ], "drink_in": true }, { "name": "goralska", + "pos_in_card": 19, "price": 42, "spiciness": false, "vege": false, @@ -201,6 +221,7 @@ }, { "name": "prosciutto", + "pos_in_card": 20, "price": 43, "spiciness": false, "vege": false, @@ -211,6 +232,7 @@ }, { "name": "broccoli", + "pos_in_card": 21, "price": 44, "spiciness": false, "vege": true, @@ -221,26 +243,29 @@ }, { "name": "americana", + "pos_in_card": 22, "price": 45, "spiciness": true, "vege": false, "size": 50, - "allergens": "", + "allergens": "none", "ingridients": [ "cheese", "salami", "papperoni", "onion", "corn" ], - "drink_in": false + "drink_in": true }, { "name": "farmerska", + "pos_in_card": 23, "price": 47, "spiciness": true, "vege": false, "size": 30, - "allergens": "", + "allergens": "none", "ingridients": [ "cheese", "sausage", "ham", "salami", "chicken", "pepperoni" ], "drink_in": false }, { "name": "nachos", + "pos_in_card": 24, "price": 48, "spiciness": true, "vege": false, @@ -251,6 +276,7 @@ }, { "name": "texas", + "pos_in_card": 25, "price": 48, "spiciness": true, "vege": false, @@ -261,16 +287,18 @@ }, { "name": "kurczak", + "pos_in_card": 26, "price": 49, "spiciness": false, "vege": false, "size": 50, "allergens": "tomato", "ingridients": [ "cheese", "chicken", "onion", "corn", "toamto" ], - "drink_in": false + "drink_in": true }, { "name": "zielona", + "pos_in_card": 27, "price": 50, "spiciness": false, "vege": true, @@ -281,13 +309,14 @@ }, { "name": "mix", + "pos_in_card": 28, "price": 50, "spiciness": true, "vege": false, "size": 50, "allergens": "feta", "ingridients": [ "cheese", "ham", "salami", "papperoni", "sausage", "mushrooms", "corn", "broccoli", "pineapple", "feta" ], - "drink_in": false + "drink_in": true } ] \ No newline at end of file diff --git a/tiles.py b/tiles.py index 92f114a..86e9b08 100644 --- a/tiles.py +++ b/tiles.py @@ -5,6 +5,10 @@ import pygame import pytmx from queue import Queue import math +import pandas as pd +from sklearn.model_selection import train_test_split +from sklearn.tree import DecisionTreeClassifier +import json pygame.init() @@ -117,8 +121,9 @@ def check_collision_with_chair(x,y): class Food: - def __init__(self, name, price, spiciness, vege, size, allergens, ingridients, drink_in): + def __init__(self, name, pos_in_card, price, spiciness, vege, size, allergens, ingridients, drink_in): self.name = name + self.pos_in_card = pos_in_card self.price = price self.spiciness = spiciness self.vege = vege @@ -373,6 +378,7 @@ def astar(map, start, end): continue open_list.append(child) + def tell_preferences(): possibilities = [[30, 40 ,50, None], [True, False, None], @@ -384,17 +390,110 @@ def tell_preferences(): choices = [] for i in possibilities: choices.append(random.choice(i)) - preferences = { - "budget": choices[0], - "spiciness": choices[1], - "vege": choices[2], - "level_of_hunger": choices[3], - "allergy": choices[4], - "favorite_ingridient": choices[5], - "drink_in": choices[6] - } - return preferences + return choices + +def evaluate_preferences(preferences): + data = [] + if preferences[0] == 30: + data.append(30) + elif preferences[0] == 40: + data.append(40) + elif preferences[0] == 50: + data.append(50) + else: + data.append(random.choice([30, 40, 50])) + + if preferences[1] is True: + data.append(1) + elif preferences[1] is False: + data.append(0) + else: + data.append(random.choice([1, 0])) + + if preferences[2] is True: + data.append(1) + elif preferences[2] is False: + data.append(0) + else: + data.append(random.choice([1, 0])) + + if preferences[3] == 'low': + data.append(30) + elif preferences[3] == 'high': + data.append(50) + else: + data.append(random.choice([30, 50])) + + if preferences[4] == 'tomato': + data.append(1) + elif preferences[4] == 'olives': + data.append(3) + elif preferences[4] == 'feta': + data.append(2) + else: + data.append(0) + + if preferences[5] == 'salami': + data.append(1) + elif preferences[5] == 'mushrooms': + data.append(2) + elif preferences[5] == 'pineapple': + data.append(3) + elif preferences[5] == 'shrimps': + data.append(4) + elif preferences[5] == 'sausage': + data.append(5) + else: + data.append(0) + + if preferences[6] is True: + data.append(1) + elif preferences[6] is False: + data.append(0) + else: + data.append(random.choice([1, 0])) + + return data + +def choose_pizza(prefernce): + df = pd.read_excel("data.xlsx") + + d = {'low': 30, 'high': 50} + df['level of hunger'] = df['level of hunger'].map(d) + + d = {'none': 0, 'tomato': 1, 'feta': 2, 'olives': 3} + df['allergy'] = df['allergy'].map(d) + + d = {'none': 0, 'salami': 1, 'mushrooms': 2, 'pineapple': 3, 'shrimps': 4, 'sausage': 5} + df['favorite ingridient'] = df['favorite ingridient'].map(d) + + d = {'margherita': 0, 'hawajska': 1, 'funghi': 2, 'light': 3, '4 sery': 4, 'pepperoni': 5, + 'salami': 6, 'wegetarianska': 7, 'barbecue': 8, 'miesna': 9, 'paprykowa': 10, + 'jalapeno': 11, 'barbecue wege': 12, 'kebab': 13, 'grecka': 14, 'piekielna': 15, + 'drwala': 16, 'grzybowa': 17, 'staropolska': 18, 'goralska': 19, 'prosciutto': 20, + 'broccoli': 21, 'americana': 22, 'farmerska': 23, 'nachos': 24, 'texas': 25, + 'kurczak': 26, 'zielona': 27, 'mix': 28} + + df['pizza'] = df['pizza'].map(d) + + features = ['budget', 'spiciness', 'vege', 'level of hunger', 'allergy', 'favorite ingridient', 'drink in'] + x = df[features] + y = df['pizza'] + x_train, x_test, y_train, y_test = train_test_split(x, y) + + clf = DecisionTreeClassifier(criterion='entropy') + clf = clf.fit(x_train, y_train) + + return clf.predict([prefernce]) + +def get_pizza(number): + with open("dishes.json") as f: + data = json.load(f) + for i in data: + if i["pos_in_card"] == int(number): + food = Food(i['name'], i['pos_in_card'], i['price'], i['spiciness'], i['vege'], i['size'], i['allergens'], i['ingridients'], i['drink_in']) + return food map = Map() waiter = Waiter([32, 32]) @@ -454,11 +553,9 @@ def main(): if y > 608 or y < 32 or x > 608 or x < 32 or check_collision_with_table(y,x) or check_collision_with_chair(y, x): print("I can't go there") break - print(x,y) goal = (x // 32, y // 32) route = astar(map.get_arr(), (waiter.loc[1] // 32, waiter.loc[0] // 32), goal) direction = [(x[1] - y[1], x[0] - y[0]) for x, y in zip(route[1:], route)] - print(waiter.loc) break elif middle: if client.loc[0] in [64, 128, 192, 256, 352, 416, 480, 544]: @@ -478,8 +575,18 @@ def main(): direction = [(x[1] - y[1], x[0] - y[0]) for x, y in zip(route[1:], route)] break print("Hello Sir, tell me yours preferences") + print("Pass: 'budget', 'spiciness', 'vege', 'level_of_hunger', 'allergy', 'favorite_ingridient', 'drink_in'\n") print("Here is my list of preferences") - print(tell_preferences()) + ingridients = tell_preferences() + print(ingridients) + print() + evaluated_ingridients = evaluate_preferences(ingridients) + number_of_pizza = choose_pizza(evaluated_ingridients) + pizza = get_pizza(number_of_pizza) + print("In case we don't offer pizza with identical ingredients, we offer:") + print("Name = {}, pos_in_card - {}, price = {}, spiciness = {}, vege = {}, size = {}, allergens = {}, ingridients = {}, drink_in = {}\n" + .format(pizza.name,pizza.pos_in_card,pizza.price, pizza.spiciness,pizza.vege,pizza.size,pizza.allergens,pizza.ingridients,pizza.drink_in)) + if len(direction) > 0: d = direction.pop(0)