added vegetables strorage in tractor and vegetables store

This commit is contained in:
s473554 2023-05-25 13:21:43 +02:00
parent cd088a7d00
commit 233f218899
4 changed files with 668 additions and 0 deletions

257
01.csv Normal file
View File

@ -0,0 +1,257 @@
can it get to the next point,will it be able to get to the gas station,will it be able to get to the gas station after arriving at the next point,will it be able to take the next vegetable to the tractor storage,will it be able to get to the vegetable warehouse,will it be able to get to the gas station after it arrives at the vegetable warehouse,is the vegetable warehouse closed,is the gas station closed,go to: 1)next veget. 2)gas station 3)warehouse 4)sleep 5)GAME OVER
0,0,0,0,0,0,0,0,5
0,0,0,0,0,0,0,1,5
0,0,0,0,0,0,1,0,5
0,0,0,0,0,0,1,1,5
0,0,0,0,0,1,0,0,5
0,0,0,0,0,1,0,1,5
0,0,0,0,0,1,1,0,5
0,0,0,0,0,1,1,1,5
0,0,0,0,1,0,0,0,5
0,0,0,0,1,0,0,1,5
0,0,0,0,1,0,1,0,5
0,0,0,0,1,0,1,1,5
0,0,0,0,1,1,0,0,5
0,0,0,0,1,1,0,1,5
0,0,0,0,1,1,1,0,5
0,0,0,0,1,1,1,1,5
0,0,0,1,0,0,0,0,5
0,0,0,1,0,0,0,1,5
0,0,0,1,0,0,1,0,5
0,0,0,1,0,0,1,1,5
0,0,0,1,0,1,0,0,5
0,0,0,1,0,1,0,1,5
0,0,0,1,0,1,1,0,5
0,0,0,1,0,1,1,1,5
0,0,0,1,1,0,0,0,5
0,0,0,1,1,0,0,1,5
0,0,0,1,1,0,1,0,5
0,0,0,1,1,0,1,1,5
0,0,0,1,1,1,0,0,5
0,0,0,1,1,1,0,1,5
0,0,0,1,1,1,1,0,5
0,0,0,1,1,1,1,1,5
0,0,1,0,0,0,0,0,5
0,0,1,0,0,0,0,1,5
0,0,1,0,0,0,1,0,5
0,0,1,0,0,0,1,1,5
0,0,1,0,0,1,0,0,5
0,0,1,0,0,1,0,1,5
0,0,1,0,0,1,1,0,5
0,0,1,0,0,1,1,1,5
0,0,1,0,1,0,0,0,5
0,0,1,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1,1,0,1,0,1,0,0,2
1,1,0,1,0,1,0,1,4
1,1,0,1,0,1,1,0,2
1,1,0,1,0,1,1,1,4
1,1,0,1,1,0,0,0,2
1,1,0,1,1,0,0,1,4
1,1,0,1,1,0,1,0,2
1,1,0,1,1,0,1,1,4
1,1,0,1,1,1,0,0,2
1,1,0,1,1,1,0,1,4
1,1,0,1,1,1,1,0,2
1,1,0,1,1,1,1,1,4
1,1,1,0,0,0,0,0,2
1,1,1,0,0,0,0,1,4
1,1,1,0,0,0,1,0,2
1,1,1,0,0,0,1,1,4
1,1,1,0,0,1,0,0,2
1,1,1,0,0,1,0,1,4
1,1,1,0,0,1,1,0,2
1,1,1,0,0,1,1,1,4
1,1,1,0,1,0,0,0,2
1,1,1,0,1,0,0,1,4
1,1,1,0,1,0,1,0,2
1,1,1,0,1,0,1,1,4
1,1,1,0,1,1,0,0,3
1,1,1,0,1,1,0,1,3
1,1,1,0,1,1,1,0,4
1,1,1,0,1,1,1,1,4
1,1,1,1,0,0,0,0,1
1,1,1,1,0,0,0,1,1
1,1,1,1,0,0,1,0,1
1,1,1,1,0,0,1,1,1
1,1,1,1,0,1,0,0,1
1,1,1,1,0,1,0,1,1
1,1,1,1,0,1,1,0,1
1,1,1,1,0,1,1,1,1
1,1,1,1,1,0,0,0,1
1,1,1,1,1,0,0,1,1
1,1,1,1,1,0,1,0,1
1,1,1,1,1,0,1,1,1
1,1,1,1,1,1,0,0,1
1,1,1,1,1,1,0,1,1
1,1,1,1,1,1,1,0,1
1,1,1,1,1,1,1,1,1
1 can it get to the next point will it be able to get to the gas station will it be able to get to the gas station after arriving at the next point will it be able to take the next vegetable to the tractor storage will it be able to get to the vegetable warehouse will it be able to get to the gas station after it arrives at the vegetable warehouse is the vegetable warehouse closed is the gas station closed go to: 1)next veget. 2)gas station 3)warehouse 4)sleep 5)GAME OVER
2 0 0 0 0 0 0 0 0 5
3 0 0 0 0 0 0 0 1 5
4 0 0 0 0 0 0 1 0 5
5 0 0 0 0 0 0 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0 0 0 0 2
211 1 1 0 1 0 0 0 1 4
212 1 1 0 1 0 0 1 0 2
213 1 1 0 1 0 0 1 1 4
214 1 1 0 1 0 1 0 0 2
215 1 1 0 1 0 1 0 1 4
216 1 1 0 1 0 1 1 0 2
217 1 1 0 1 0 1 1 1 4
218 1 1 0 1 1 0 0 0 2
219 1 1 0 1 1 0 0 1 4
220 1 1 0 1 1 0 1 0 2
221 1 1 0 1 1 0 1 1 4
222 1 1 0 1 1 1 0 0 2
223 1 1 0 1 1 1 0 1 4
224 1 1 0 1 1 1 1 0 2
225 1 1 0 1 1 1 1 1 4
226 1 1 1 0 0 0 0 0 2
227 1 1 1 0 0 0 0 1 4
228 1 1 1 0 0 0 1 0 2
229 1 1 1 0 0 0 1 1 4
230 1 1 1 0 0 1 0 0 2
231 1 1 1 0 0 1 0 1 4
232 1 1 1 0 0 1 1 0 2
233 1 1 1 0 0 1 1 1 4
234 1 1 1 0 1 0 0 0 2
235 1 1 1 0 1 0 0 1 4
236 1 1 1 0 1 0 1 0 2
237 1 1 1 0 1 0 1 1 4
238 1 1 1 0 1 1 0 0 3
239 1 1 1 0 1 1 0 1 3
240 1 1 1 0 1 1 1 0 4
241 1 1 1 0 1 1 1 1 4
242 1 1 1 1 0 0 0 0 1
243 1 1 1 1 0 0 0 1 1
244 1 1 1 1 0 0 1 0 1
245 1 1 1 1 0 0 1 1 1
246 1 1 1 1 0 1 0 0 1
247 1 1 1 1 0 1 0 1 1
248 1 1 1 1 0 1 1 0 1
249 1 1 1 1 0 1 1 1 1
250 1 1 1 1 1 0 0 0 1
251 1 1 1 1 1 0 0 1 1
252 1 1 1 1 1 0 1 0 1
253 1 1 1 1 1 0 1 1 1
254 1 1 1 1 1 1 0 0 1
255 1 1 1 1 1 1 0 1 1
256 1 1 1 1 1 1 1 0 1
257 1 1 1 1 1 1 1 1 1

BIN
01.xlsx Normal file

Binary file not shown.

257
10.csv Normal file
View File

@ -0,0 +1,257 @@
can it get to the next point,will it be able to get to the gas station,will it be able to get to the gas station after arriving at the next point,will it be able to take the next vegetable to the tractor storage,will it be able to get to the vegetable warehouse,will it be able to get to the gas station after it arrives at the vegetable warehouse,is the vegetable warehouse closed,is the gas station closed,go to: 1)next veget. 2)gas station 3)warehouse 4)sleep 5)GAME OVER
0,0,0,0,0,0,0,0,5
0,0,0,0,0,0,0,1,5
0,0,0,0,0,0,1,0,5
0,0,0,0,0,0,1,1,5
0,0,0,0,0,1,0,0,5
0,0,0,0,0,1,0,1,5
0,0,0,0,0,1,1,0,5
0,0,0,0,0,1,1,1,5
0,0,0,0,1,0,0,0,5
0,0,0,0,1,0,0,1,5
0,0,0,0,1,0,1,0,5
0,0,0,0,1,0,1,1,5
0,0,0,0,1,1,0,0,5
0,0,0,0,1,1,0,1,5
0,0,0,0,1,1,1,0,5
0,0,0,0,1,1,1,1,5
0,0,0,1,0,0,0,0,5
0,0,0,1,0,0,0,1,5
0,0,0,1,0,0,1,0,5
0,0,0,1,0,0,1,1,5
0,0,0,1,0,1,0,0,5
0,0,0,1,0,1,0,1,5
0,0,0,1,0,1,1,0,5
0,0,0,1,0,1,1,1,5
0,0,0,1,1,0,0,0,5
0,0,0,1,1,0,0,1,5
0,0,0,1,1,0,1,0,5
0,0,0,1,1,0,1,1,5
0,0,0,1,1,1,0,0,5
0,0,0,1,1,1,0,1,5
0,0,0,1,1,1,1,0,5
0,0,0,1,1,1,1,1,5
0,0,1,0,0,0,0,0,5
0,0,1,0,0,0,0,1,5
0,0,1,0,0,0,1,0,5
0,0,1,0,0,0,1,1,5
0,0,1,0,0,1,0,0,5
0,0,1,0,0,1,0,1,5
0,0,1,0,0,1,1,0,5
0,0,1,0,0,1,1,1,5
0,0,1,0,1,0,0,0,5
0,0,1,0,1,0,0,1,5
0,0,1,0,1,0,1,0,5
0,0,1,0,1,0,1,1,5
0,0,1,0,1,1,0,0,5
0,0,1,0,1,1,0,1,5
0,0,1,0,1,1,1,0,5
0,0,1,0,1,1,1,1,5
0,0,1,1,0,0,0,0,5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,1,1,4
1,1,0,1,1,1,0,0,2
1,1,0,1,1,1,0,1,4
1,1,0,1,1,1,1,0,2
1,1,0,1,1,1,1,1,4
1,1,1,0,0,0,0,0,2
1,1,1,0,0,0,0,1,4
1,1,1,0,0,0,1,0,2
1,1,1,0,0,0,1,1,4
1,1,1,0,0,1,0,0,2
1,1,1,0,0,1,0,1,4
1,1,1,0,0,1,1,0,2
1,1,1,0,0,1,1,1,4
1,1,1,0,1,0,0,0,2
1,1,1,0,1,0,0,1,4
1,1,1,0,1,0,1,0,2
1,1,1,0,1,0,1,1,4
1,1,1,0,1,1,0,0,3
1,1,1,0,1,1,0,1,3
1,1,1,0,1,1,1,0,4
1,1,1,0,1,1,1,1,4
1,1,1,1,0,0,0,0,1
1,1,1,1,0,0,0,1,1
1,1,1,1,0,0,1,0,1
1,1,1,1,0,0,1,1,1
1,1,1,1,0,1,0,0,1
1,1,1,1,0,1,0,1,1
1,1,1,1,0,1,1,0,1
1,1,1,1,0,1,1,1,1
1,1,1,1,1,0,0,0,1
1,1,1,1,1,0,0,1,1
1,1,1,1,1,0,1,0,1
1,1,1,1,1,0,1,1,1
1,1,1,1,1,1,0,0,1
1,1,1,1,1,1,0,1,1
1,1,1,1,1,1,1,0,1
1,1,1,1,1,1,1,1,1
1 can it get to the next point will it be able to get to the gas station will it be able to get to the gas station after arriving at the next point will it be able to take the next vegetable to the tractor storage will it be able to get to the vegetable warehouse will it be able to get to the gas station after it arrives at the vegetable warehouse is the vegetable warehouse closed is the gas station closed go to: 1)next veget. 2)gas station 3)warehouse 4)sleep 5)GAME OVER
2 0 0 0 0 0 0 0 0 5
3 0 0 0 0 0 0 0 1 5
4 0 0 0 0 0 0 1 0 5
5 0 0 0 0 0 0 1 1 5
6 0 0 0 0 0 1 0 0 5
7 0 0 0 0 0 1 0 1 5
8 0 0 0 0 0 1 1 0 5
9 0 0 0 0 0 1 1 1 5
10 0 0 0 0 1 0 0 0 5
11 0 0 0 0 1 0 0 1 5
12 0 0 0 0 1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
115 0 1 1 1 0 0 0 1 4
116 0 1 1 1 0 0 1 0 2
117 0 1 1 1 0 0 1 1 4
118 0 1 1 1 0 1 0 0 2
119 0 1 1 1 0 1 0 1 4
120 0 1 1 1 0 1 1 0 2
121 0 1 1 1 0 1 1 1 4
122 0 1 1 1 1 0 0 0 2
123 0 1 1 1 1 0 0 1 4
124 0 1 1 1 1 0 1 0 2
125 0 1 1 1 1 0 1 1 4
126 0 1 1 1 1 1 0 0 2
127 0 1 1 1 1 1 0 1 4
128 0 1 1 1 1 1 1 0 2
129 0 1 1 1 1 1 1 1 4
130 1 0 0 0 0 0 0 0 5
131 1 0 0 0 0 0 0 1 5
132 1 0 0 0 0 0 1 0 5
133 1 0 0 0 0 0 1 1 5
134 1 0 0 0 0 1 0 0 5
135 1 0 0 0 0 1 0 1 5
136 1 0 0 0 0 1 1 0 5
137 1 0 0 0 0 1 1 1 5
138 1 0 0 0 1 0 0 0 5
139 1 0 0 0 1 0 0 1 5
140 1 0 0 0 1 0 1 0 5
141 1 0 0 0 1 0 1 1 5
142 1 0 0 0 1 1 0 0 5
143 1 0 0 0 1 1 0 1 5
144 1 0 0 0 1 1 1 0 5
145 1 0 0 0 1 1 1 1 5
146 1 0 0 1 0 0 0 0 5
147 1 0 0 1 0 0 0 1 5
148 1 0 0 1 0 0 1 0 5
149 1 0 0 1 0 0 1 1 5
150 1 0 0 1 0 1 0 0 5
151 1 0 0 1 0 1 0 1 5
152 1 0 0 1 0 1 1 0 5
153 1 0 0 1 0 1 1 1 5
154 1 0 0 1 1 0 0 0 5
155 1 0 0 1 1 0 0 1 5
156 1 0 0 1 1 0 1 0 5
157 1 0 0 1 1 0 1 1 5
158 1 0 0 1 1 1 0 0 5
159 1 0 0 1 1 1 0 1 5
160 1 0 0 1 1 1 1 0 5
161 1 0 0 1 1 1 1 1 5
162 1 0 1 0 0 0 0 0 5
163 1 0 1 0 0 0 0 1 5
164 1 0 1 0 0 0 1 0 5
165 1 0 1 0 0 0 1 1 5
166 1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 1 0 1 1 1 4
218 1 1 0 1 1 0 0 0 2
219 1 1 0 1 1 0 0 1 4
220 1 1 0 1 1 0 1 0 2
221 1 1 0 1 1 0 1 1 4
222 1 1 0 1 1 1 0 0 2
223 1 1 0 1 1 1 0 1 4
224 1 1 0 1 1 1 1 0 2
225 1 1 0 1 1 1 1 1 4
226 1 1 1 0 0 0 0 0 2
227 1 1 1 0 0 0 0 1 4
228 1 1 1 0 0 0 1 0 2
229 1 1 1 0 0 0 1 1 4
230 1 1 1 0 0 1 0 0 2
231 1 1 1 0 0 1 0 1 4
232 1 1 1 0 0 1 1 0 2
233 1 1 1 0 0 1 1 1 4
234 1 1 1 0 1 0 0 0 2
235 1 1 1 0 1 0 0 1 4
236 1 1 1 0 1 0 1 0 2
237 1 1 1 0 1 0 1 1 4
238 1 1 1 0 1 1 0 0 3
239 1 1 1 0 1 1 0 1 3
240 1 1 1 0 1 1 1 0 4
241 1 1 1 0 1 1 1 1 4
242 1 1 1 1 0 0 0 0 1
243 1 1 1 1 0 0 0 1 1
244 1 1 1 1 0 0 1 0 1
245 1 1 1 1 0 0 1 1 1
246 1 1 1 1 0 1 0 0 1
247 1 1 1 1 0 1 0 1 1
248 1 1 1 1 0 1 1 0 1
249 1 1 1 1 0 1 1 1 1
250 1 1 1 1 1 0 0 0 1
251 1 1 1 1 1 0 0 1 1
252 1 1 1 1 1 0 1 0 1
253 1 1 1 1 1 0 1 1 1
254 1 1 1 1 1 1 0 0 1
255 1 1 1 1 1 1 0 1 1
256 1 1 1 1 1 1 1 0 1
257 1 1 1 1 1 1 1 1 1

154
IC3.py Normal file
View File

@ -0,0 +1,154 @@
import pandas as pd
import numpy as np
import json
train_data_m = pd.read_csv("01.csv")
test_data_m = pd.read_csv("10.csv")
def calc_total_entropy(train_data, label, class_list):
total_row = train_data.shape[0]
total_entr = 0
for c in class_list:
total_class_count = train_data[train_data[label] == c].shape[0]
if total_class_count == 0:
total_class_entr = 0
else:
total_class_entr = - (total_class_count / total_row) * np.log2(total_class_count / total_row)
total_entr += total_class_entr
return total_entr
def calc_entropy(feature_value_data, label, class_list):
class_count = feature_value_data.shape[0]
entropy = 0
for c in class_list:
label_class_count = feature_value_data[feature_value_data[label] == c].shape[0]
entropy_class = 0
if label_class_count != 0:
probability_class = label_class_count / class_count
entropy_class = - probability_class * np.log2(probability_class)
entropy += entropy_class
return entropy
def calc_info_gain(feature_name, train_data, label, class_list):
feature_value_list = train_data[feature_name].unique()
total_row = train_data.shape[0]
feature_info = 0.0
for feature_value in feature_value_list:
feature_value_data = train_data[train_data[feature_name] == feature_value]
feature_value_count = feature_value_data.shape[0]
feature_value_entropy = calc_entropy(feature_value_data, label, class_list)
feature_value_probability = feature_value_count / total_row
feature_info += feature_value_probability * feature_value_entropy
return calc_total_entropy(train_data, label, class_list) - feature_info
def find_most_informative_feature(train_data, label, class_list):
feature_list = train_data.columns.drop(label)
max_info_gain = -1
max_info_feature = None
for feature in feature_list:
feature_info_gain = calc_info_gain(feature, train_data, label, class_list)
if max_info_gain < feature_info_gain:
max_info_gain = feature_info_gain
max_info_feature = feature
return max_info_feature
def generate_sub_tree(feature_name, train_data, label, class_list):
feature_value_count_dict = train_data[feature_name].value_counts(sort=False)
tree = {}
for feature_value, count in feature_value_count_dict.items():
feature_value_data = train_data[train_data[feature_name] == feature_value]
assigned_to_node = False
for c in class_list:
class_count = feature_value_data[feature_value_data[label] == c].shape[0]
if class_count == count:
tree[feature_value] = c
train_data = train_data[train_data[feature_name] != feature_value]
assigned_to_node = True
if not assigned_to_node:
tree[feature_value] = "?"
return tree, train_data
def make_tree(root, prev_feature_value, train_data, label, class_list):
if train_data.shape[0] != 0:
max_info_feature = find_most_informative_feature(train_data, label, class_list)
tree, train_data = generate_sub_tree(max_info_feature, train_data, label, class_list)
next_root = None
if prev_feature_value != None:
root[prev_feature_value] = dict()
root[prev_feature_value][max_info_feature] = tree
next_root = root[prev_feature_value][max_info_feature]
else:
root[max_info_feature] = tree
next_root = root[max_info_feature]
for node, branch in list(next_root.items()):
if branch == "?":
feature_value_data = train_data[train_data[max_info_feature] == node]
make_tree(next_root, node, feature_value_data, label, class_list)
def id3(train_data_m, label):
train_data = train_data_m.copy()
tree = {}
class_list = train_data[label].unique()
make_tree(tree, None, train_data, label, class_list)
return tree
def predict(tree, instance):
if not isinstance(tree, dict):
return tree
else:
root_node = next(iter(tree))
feature_value = instance[root_node]
if feature_value in tree[root_node]:
return predict(tree[root_node][feature_value], instance)
else:
return None
def evaluate(tree, test_data_m, label):
correct_preditct = 0
wrong_preditct = 0
for index, row in test_data_m.iterrows():
result = predict(tree, test_data_m.iloc[index])
if result == test_data_m[label].iloc[index]:
correct_preditct += 1
else:
wrong_preditct += 1
accuracy = correct_preditct / (correct_preditct + wrong_preditct)
return accuracy
class NpEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, np.integer):
return int(obj)
if isinstance(obj, np.floating):
return float(obj)
if isinstance(obj, np.ndarray):
return obj.tolist()
return json.JSONEncoder.default(self, obj)
tree = id3(train_data_m, 'go to: 1)next veget. 2)gas station 3)warehouse 4)sleep 5)GAME OVER')
# print(tree)
json_str = json.dumps(tree, indent=2, cls=NpEncoder)
print(json_str)
accuracy = evaluate(tree, test_data_m, 'go to: 1)next veget. 2)gas station 3)warehouse 4)sleep 5)GAME OVER') #evaluating the test dataset
print(accuracy)