aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--simulation/plot_utils.py48
-rw-r--r--simulation/plots/finale.pngbin0 -> 45728 bytes
2 files changed, 36 insertions, 12 deletions
diff --git a/simulation/plot_utils.py b/simulation/plot_utils.py
index af5269c..9472707 100644
--- a/simulation/plot_utils.py
+++ b/simulation/plot_utils.py
@@ -1,4 +1,6 @@
+import numpy as np
import matplotlib.pyplot as plt
+import matplotlib
import argparse
import json
import seaborn
@@ -11,16 +13,38 @@ parser.add_argument('f', help='list of logs to parse', nargs='+')
parser.add_argument('-dest', help='name of figure to save', default='fig.png')
args = parser.parse_args()
-for file_name in args.f:
- x, y = [], []
- with open(file_name) as f:
- for line in f:
- jason = json.loads(line)
- x.append(jason[args.x])
- y.append(jason[args.y])
- plt.plot(x, y, label=file_name)
-plt.legend()
-plt.xlabel(args.x)
-plt.ylabel(args.y)
-plt.savefig(args.dest)
+def default():
+ for file_name in args.f:
+ x, y = [], []
+ with open(file_name) as f:
+ for line in f:
+ jason = json.loads(line)
+ x.append(jason[args.x])
+ y.append(jason[args.y])
+ plt.plot(x, y, label=file_name)
+
+ plt.legend()
+ plt.xlabel(args.x)
+ plt.ylabel(args.y)
+ plt.savefig(args.dest)
+
+def tmp_finale():
+ plt.clf()
+ for file_name in args.f:
+ x, y = [], []
+ with open(file_name) as f:
+ for index, line in zip(range(15), f):
+ assert index <= 15
+ jason = json.loads(line)
+ x.append(jason[args.x])
+ y.append(np.sqrt(jason[args.y]))
+ plt.plot(x, y, label=file_name)
+
+ plt.legend(fontsize=15)
+ plt.xlabel(r"Nbr of Batches (size $100$)", fontsize=15)
+ plt.ylabel(r"RMSE", fontsize=15)
+ plt.savefig(args.dest)
+
+if __name__ == "__main__":
+ tmp_finale()
diff --git a/simulation/plots/finale.png b/simulation/plots/finale.png
new file mode 100644
index 0000000..59378f9
--- /dev/null
+++ b/simulation/plots/finale.png
Binary files differ