Merge pull request 'fix path' (#26) from decision_tree_trashbins into master

Reviewed-on: #26
This commit is contained in:
Bartosz Wieczorek 2022-05-13 12:47:36 +02:00
commit 5ab9a3c30c
7 changed files with 1273 additions and 20 deletions

View File

@ -9,7 +9,7 @@ attributes = ["season", "trash_type", "mass", "space", "trash_mass"]
# return tree made from attributes # return tree made from attributes
def tree(): def tree():
dataset = pandas.read_csv('/Users/mac/Desktop/tree_dataset.csv', sep=";") dataset = pandas.read_csv('decision_tree/tree_dataset.csv', sep=";")
x = dataset[attributes] x = dataset[attributes]
y = dataset[decisions] y = dataset[decisions]

View File

@ -4,12 +4,12 @@
| | | |--- class: 0 | | | |--- class: 0
| | |--- feature_0 > 1.50 | | |--- feature_0 > 1.50
| | | |--- feature_3 <= 3.50 | | | |--- feature_3 <= 3.50
| | | | |--- feature_2 <= 2.50 | | | | |--- feature_4 <= 2.50
| | | | | |--- class: 1 | | | | | |--- class: 1
| | | | |--- feature_2 > 2.50 | | | | |--- feature_4 > 2.50
| | | | | |--- feature_4 <= 2.50 | | | | | |--- feature_2 <= 2.50
| | | | | | |--- class: 1 | | | | | | |--- class: 1
| | | | | |--- feature_4 > 2.50 | | | | | |--- feature_2 > 2.50
| | | | | | |--- class: 0 | | | | | | |--- class: 0
| | | |--- feature_3 > 3.50 | | | |--- feature_3 > 3.50
| | | | |--- feature_3 <= 4.50 | | | | |--- feature_3 <= 4.50
@ -26,12 +26,12 @@
| | | | | | | |--- feature_1 > 1.50 | | | | | | | |--- feature_1 > 1.50
| | | | | | | | |--- class: 0 | | | | | | | | |--- class: 0
| | | | | | |--- feature_0 > 2.50 | | | | | | |--- feature_0 > 2.50
| | | | | | | |--- feature_4 <= 2.50 | | | | | | | |--- feature_2 <= 2.50
| | | | | | | | |--- class: 1 | | | | | | | | |--- class: 1
| | | | | | | |--- feature_4 > 2.50 | | | | | | | |--- feature_2 > 2.50
| | | | | | | | |--- feature_2 <= 2.50 | | | | | | | | |--- feature_4 <= 2.50
| | | | | | | | | |--- class: 1 | | | | | | | | | |--- class: 1
| | | | | | | | |--- feature_2 > 2.50 | | | | | | | | |--- feature_4 > 2.50
| | | | | | | | | |--- class: 0 | | | | | | | | | |--- class: 0
| | | | | |--- feature_1 > 2.50 | | | | | |--- feature_1 > 2.50
| | | | | | |--- feature_0 <= 3.50 | | | | | | |--- feature_0 <= 3.50
@ -73,8 +73,8 @@
| | |--- feature_2 > 1.50 | | |--- feature_2 > 1.50
| | | |--- class: 0 | | | |--- class: 0
|--- feature_2 > 3.50 |--- feature_2 > 3.50
| |--- feature_1 <= 1.50 | |--- feature_4 <= 1.50
| | |--- feature_4 <= 1.50 | | |--- feature_1 <= 1.50
| | | |--- feature_2 <= 4.50 | | | |--- feature_2 <= 4.50
| | | | |--- feature_3 <= 4.50 | | | | |--- feature_3 <= 4.50
| | | | | |--- feature_0 <= 1.50 | | | | | |--- feature_0 <= 1.50
@ -85,7 +85,7 @@
| | | | | |--- class: 0 | | | | | |--- class: 0
| | | |--- feature_2 > 4.50 | | | |--- feature_2 > 4.50
| | | | |--- class: 0 | | | | |--- class: 0
| | |--- feature_4 > 1.50 | | |--- feature_1 > 1.50
| | | |--- class: 0 | | | |--- class: 0
| |--- feature_1 > 1.50 | |--- feature_4 > 1.50
| | |--- class: 0 | | |--- class: 0

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -18,6 +18,7 @@ class aiPlayer():
self.player.update() self.player.update()
self.game.draw() self.game.draw()
# print(self.player.get_actual_coords()) # print(self.player.get_actual_coords())
def turn_left(self): def turn_left(self):
change = int(self.player.rotation()) - 1 change = int(self.player.rotation()) - 1

View File

@ -13,7 +13,7 @@ class Trashbin(Tile):
self.trash_type = randrange(5) self.trash_type = randrange(5)
self.mass = randrange(5) self.mass = randrange(5)
self.space = randrange(5) self.space = randrange(5)
self.trash_mass = randrange(5) self.trash_mass = randrange(5)
def get_coords(self): def get_coords(self):

13
main.py
View File

@ -113,17 +113,18 @@ class Game():
self.negative_decision.append(i) self.negative_decision.append(i)
self.negative_actions.append(i) self.negative_actions.append(i)
# j = 0 for i in self.positive_actions:
# for i in self.positive_actions: print('----')
print(i)
# print(f"step {j} actions is : {i}") print('----')
# j+=1
# vec = pg.math.Vector2 # vec = pg.math.Vector2
# for i in self.positive_actions: # for i in self.positive_actions:
# self.t.startAiController(i) # self.t.startAiController(i)
# self.player.update()
# self.player.pos = vec(32, 32) # self.player.pos = vec(32, 32)
# self.player.update()
self.t.startAiController(self.positive_actions[0]) self.t.startAiController(self.positive_actions[0])