-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheval.py
More file actions
75 lines (59 loc) · 2.25 KB
/
Copy patheval.py
File metadata and controls
75 lines (59 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
ACTOR = "actor_6553600"
data = pd.read_csv(f"{ACTOR}_metrics.csv")
evader_type = data["evader_type"]
first_seen = data["first_seen"]
time_in_fov = data["time_in_fov"]
evader_seen = data["evader_seen"]
pursuer_win = data["pursuer_win"]
print(f"\nTHIS DATA COMES FROM {len(first_seen)} GAMES\n")
print("FIRST SEEN")
print(f"Average time first seen: {np.mean(first_seen)}")
print(f"Minimum time first seen: {np.min(first_seen)}")
print(f"Maximum time first seen: {np.max(first_seen)}")
print("============================\n")
print("TIME IN FOV")
print(f"Average time in FOV: {np.mean(time_in_fov)}")
print(f"Minimum time in FOV: {np.min(time_in_fov)}")
print(f"Maximum time in FOV: {np.max(time_in_fov)}")
print("============================\n")
print("EVADER SEEN")
print(f"Percentage of evader seen: {np.sum(evader_seen) / len(evader_seen)}")
print("============================\n")
print("PURSUER WIN")
print(f"Percentage of pursuer wins: {np.mean(pursuer_win)}")
print("============================\n")
import pandas as pd
import matplotlib.pyplot as plt
# Set evader_type as the index for cleaner plotting
data.set_index('evader_type', inplace=True)
# Group by evader_type and compute mean
grouped = data.groupby('evader_type').mean(numeric_only=True)
# Plot each column as a bar plot
fig, axs = plt.subplots(2, 2, figsize=(10, 6))
fig.suptitle(f"Evader Type vs Various Metrics ({ACTOR})", fontsize=16)
# Plot 1: first_seen
axs[0, 0].bar(data.index, data['first_seen'])
axs[0, 0].set_title('First Seen')
axs[0, 0].set_xlabel('Evader Type')
axs[0, 0].set_ylabel('Time')
axs[0, 0].plot(kind='bar')
# Plot 2: time_in_fov
axs[0, 1].bar(data.index, data['time_in_fov'], color='orange')
axs[0, 1].set_title('Time in FOV')
axs[0, 1].set_xlabel('Evader Type')
axs[0, 1].set_ylabel('Time')
# Plot 3: evader_seen
axs[1, 0].bar(data.index, data['evader_seen'], color='green')
axs[1, 0].set_title('Evader Seen (1=True, 0=False)')
axs[1, 0].set_xlabel('Evader Type')
axs[1, 0].set_ylabel('Seen')
# Plot 4: pursuer_win
axs[1, 1].bar(data.index, data['pursuer_win'], color='red')
axs[1, 1].set_title('Pursuer Win (1=True, 0=False)')
axs[1, 1].set_xlabel('Evader Type')
axs[1, 1].set_ylabel('Win')
plt.tight_layout()
plt.show()