complete decision tree #23
Binary file not shown.
@ -12,7 +12,7 @@ y = pima.ToRemove
|
||||
|
||||
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=1)
|
||||
clf = DecisionTreeClassifier()
|
||||
clf = clf.fit(X_train,y_train)
|
||||
clf = clf.fit(X_train.values, y_train)
|
||||
|
||||
joblib.dump(clf, 'decision_tree_model.pkl')
|
||||
|
||||
|
@ -21,10 +21,12 @@ class VacuumMoveCommand(Command):
|
||||
if not self.world.accepted_move(end_x, end_y):
|
||||
return
|
||||
|
||||
if self.world.is_garbage_at(end_x, end_y):
|
||||
if self.vacuum.get_container_filling() < 100:
|
||||
self.vacuum.increase_container_filling()
|
||||
self.world.dust[end_x][end_y].pop()
|
||||
tmp = self.world.is_garbage_at(end_x, end_y)
|
||||
if len(tmp) > 0:
|
||||
for t in tmp:
|
||||
if self.vacuum.get_container_filling() < 1000:
|
||||
self.vacuum.increase_container_filling()
|
||||
self.world.dust[end_x][end_y].remove(t)
|
||||
|
||||
if self.world.is_docking_station_at(end_x, end_y):
|
||||
self.vacuum.dump_trash()
|
||||
|
@ -6,6 +6,6 @@ class Garbage(Entity):
|
||||
super().__init__(x, y, "PEEL")
|
||||
self.wet = False
|
||||
self.size = 0
|
||||
self.props = [2,2,0,0,1,5,24,1]
|
||||
self.props = [2,2,0,0,1,4,24,1]
|
||||
|
||||
# TODO GARBAGE: add more properties
|
||||
|
@ -32,11 +32,10 @@ class World:
|
||||
def is_obstacle_at(self, x: int, y: int) -> bool:
|
||||
return bool(self.obstacles[x][y])
|
||||
|
||||
def is_garbage_at(self, x: int, y: int) -> bool:
|
||||
def is_garbage_at(self, x: int, y: int):
|
||||
if len(self.dust[x][y]) == 0:
|
||||
return False
|
||||
tmp = evaluate([self.dust[x][y][0].props])
|
||||
return bool(tmp[0])
|
||||
return []
|
||||
return [i for i in self.dust[x][y] if evaluate([i.props])[0] == 1]
|
||||
|
||||
def is_docking_station_at(self, x: int, y: int) -> bool:
|
||||
return bool(self.doc_station.x == x and self.doc_station.y == y)
|
||||
|
2
main.py
2
main.py
@ -150,7 +150,9 @@ def generate_world(tiles_x: int, tiles_y: int) -> World:
|
||||
world.add_entity(Entity(3, 4, "PLANT2"))
|
||||
world.add_entity(Entity(8, 8, "PLANT2"))
|
||||
world.add_entity(Entity(9, 3, "PLANT3"))
|
||||
world.add_entity(Earring(9, 7))
|
||||
world.add_entity(Earring(5, 5))
|
||||
world.add_entity(Earring(4, 6))
|
||||
|
||||
|
||||
for x in range(world.width):
|
||||
|
Loading…
Reference in New Issue
Block a user