From 255e45fd93a3c1046a785df47711de7be700bcb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Ry=C5=BCek?= Date: Fri, 26 May 2023 02:10:21 +0200 Subject: [PATCH] added alternate dataset --- src/decisionTree/dataset_generator.py | 33 +++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/decisionTree/dataset_generator.py diff --git a/src/decisionTree/dataset_generator.py b/src/decisionTree/dataset_generator.py new file mode 100644 index 0000000..99b7a1f --- /dev/null +++ b/src/decisionTree/dataset_generator.py @@ -0,0 +1,33 @@ +import csv +import random + +battery_values = ['high', 'medium', 'low'] +distance_values = ['far', 'medium', 'close'] +mood_values = ['good', 'medium', 'bad'] +other = ['yes', 'no'] + + +training_data = [] + +for _ in range(200): + battery = random.choice(battery_values) + distance = random.choice(distance_values) + mood = random.choice(mood_values) + memory = random.randint(0,4) + dishes_held = random.randint(0,4) + """empty_basket = random.choice(other) + if empty_basket == 'yes': + dish_in_basket = 'no' + else: + dish_in_basket = random.choice(other) + dish_in_basket = random.choice(other)""" + waiting_for_order = random.choice(other) + waiting_for_dish = random.choice(other) + + example = [battery, distance, mood, memory, dishes_held, waiting_for_order, waiting_for_dish] + training_data.append(example) + +with open('data.csv', 'w', newline='') as file: + writer = csv.writer(file) + writer.writerows(training_data) +