diff options
Diffstat (limited to 'hw3/plot.py')
| -rw-r--r-- | hw3/plot.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/hw3/plot.py b/hw3/plot.py new file mode 100644 index 0000000..9797985 --- /dev/null +++ b/hw3/plot.py @@ -0,0 +1,18 @@ +import matplotlib.pyplot as plt +import seaborn as sb +from math import sqrt + +sb.set_style("white") + +values = [map(float, line.strip().split()) for line in open("results.txt")] +x, y, z = zip(*values) +y = map(sqrt, y) +z = map(sqrt, z) + +plt.figure(figsize=(9, 6)) +plt.plot(x, y, label="train") +plt.plot(x, z, label="validation") +plt.legend() +plt.xlabel("K") +plt.ylabel("RMSE") +plt.savefig("rmse.pdf") |
