This commit is contained in:
s473603 2023-05-26 16:17:10 +02:00
parent 842bf69ed8
commit 0396350f3a
2 changed files with 9 additions and 8 deletions

8
IC3.py
View File

@ -117,8 +117,8 @@ def predict(tree, instance):
else:
root_node = next(iter(tree))
feature_value = instance[root_node]
print(root_node)
print(feature_value)
# print(root_node)
# print(feature_value)
if feature_value in tree[root_node]:
return predict(tree[root_node][feature_value], instance)
else:
@ -129,9 +129,9 @@ def evaluate(tree, test_data_m, label):
correct_preditct = 0
wrong_preditct = 0
for index, row in test_data_m.iterrows():
print(test_data_m.iloc[index])
# print(test_data_m.iloc[index])
result = predict(tree, test_data_m.iloc[index])
print()
# print()
if result == test_data_m[label].iloc[index]:
correct_preditct += 1
else:

View File

@ -112,7 +112,7 @@ def draw_interface():
endpoint = get_click_mouse_pos()
a, c = graph1.a_star(startpoint, endpoint, grid)
b = getRoad(startpoint, c, a)
movement(tractor, grid, b)
#movement(tractor, grid, b)
decisionTree(startpoint, endpoint, tractor, grid, graph1)
# a, c = graph1.a_star(startpoint, endpoint)
# b = getRoad(startpoint, c, a)
@ -157,9 +157,9 @@ class Grid:
self.initialize_grid()
self.is_gas_station_closed = True
self.is_storage_closed = True
# t2 = Thread(target=close_open, args=(grid,))
# t2.setDaemon(True)
# t2.start()
t2 = Thread(target=self.close_open, args=(self,))
t2.setDaemon(True)
t2.start()
def close_open(self):
while True:
@ -304,6 +304,7 @@ def get_next_nodes(x, y, direction: Direction, grid: Grid):
def movement(tractor: Tractor, grid: Grid, road):
print(road)
n = len(road)
for i in range(n - 1):
aA = road[i]