Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ShawnShawnYou committed Mar 15, 2022
1 parent fb7ad8b commit 66fb539
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion algorithm/RNE.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def hierarchical_road_network_embedding():
# print("origin")
# print(simple_evaluate())
# print()
for i in range(100):
for i in range(10):
print(i)
hierarchical_road_network_embedding()
print()
17 changes: 9 additions & 8 deletions util/evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ def simple_evaluate(print_flag, my_test_round):
total_normal_error_rate = 0
total_overflow_error_rate = 0

test_round = 0
normal_round = 0
overflow_round = 0
test_round = 1
normal_round = 1
overflow_round = 1
for i in range(my_test_round):
s = random.randint(0, num_node - 1)
# s = 1
Expand All @@ -80,27 +80,28 @@ def simple_evaluate(print_flag, my_test_round):
try:
t = random.randint(0, num_node - 1)
# t = 200000
real_value = dijkstra_result_s[t] / 10**get_config("norm_factor")
real_value = dijkstra_result_s[t]
except Exception as e:
continue

vector_s = np.array(embedding[s]).astype(np.float)
vector_t = np.array(embedding[t]).astype(np.float)
approx_value = np.linalg.norm(vector_s - vector_t, ord=1)
approx_value = np.linalg.norm(vector_s - vector_t, ord=1) * 10**get_config("norm_factor")
# approx_value = np.sum(abs(vector_s - vector_t), keepdims=True)
error_rate_value = error_rate(approx_value, real_value) * 100

test_round += 1
total_error_rate += error_rate_value
if error_rate_value >= 100:
total_overflow_error_rate += error_rate_value
overflow_round += 1
if error_rate_value >= 10:
sample = {
"s": s,
"t": t,
"value": real_value
}
sample_set.append(sample)
if error_rate_value >= 100:
total_overflow_error_rate += error_rate_value
overflow_round += 1
else:
total_normal_error_rate += error_rate_value
normal_round += 1
Expand Down
2 changes: 1 addition & 1 deletion util/model_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def model_build():
model.M_local[model.num_inside_layer][i] = child
i += 1

# csv_model_load(model)
csv_model_load(model)

return model

Expand Down

0 comments on commit 66fb539

Please sign in to comment.