-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_ant_path_pruning.py
More file actions
31 lines (25 loc) · 947 Bytes
/
Copy pathplot_ant_path_pruning.py
File metadata and controls
31 lines (25 loc) · 947 Bytes
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
import pandas as pd
from sys import argv
import pylab
def pruning_plot(df, strategy):
for name1, group1 in df.groupby(['explore', 'decay']):
explore, decay = name1
x = []
y = []
for name2, group2 in group1.groupby('time'):
x.append(name2)
y.append(pylab.nanmean(group2['path_pruning']))
pylab.figure()
pylab.plot(x, y)
pylab.xlabel('time')
pylab.ylabel('average chosen path entropy')
figname = 'pruning/path_pruning_%s_e%fd%f.png' % (strategy, explore, decay)
pylab.savefig(figname, format='png')
pylab.close()
if __name__ == '__main__':
filename = argv[1]
strategy = argv[2]
columns = ['ants', 'explore', 'decay', 'time', 'path_pruning']
df = pd.read_csv(filename, header=None, names = columns, na_values='nan', skipinitialspace=True)
#print max(df['time'])
pruning_plot(df, strategy)