summaryrefslogtreecommitdiffstats
path: root/hw3/plot.py
diff options
context:
space:
mode:
authorThibaut Horel <thibaut.horel@gmail.com>2015-10-30 17:16:32 -0400
committerThibaut Horel <thibaut.horel@gmail.com>2015-10-30 17:16:32 -0400
commit61f644a6a7d36dc5c15d957c48d10675ab3627ae (patch)
treee765c3ac2b1239ea2728a625a7a19196c370adbe /hw3/plot.py
parent6a969e7afb0b796996f63b8d341f8891f187ca8e (diff)
downloadcs281-61f644a6a7d36dc5c15d957c48d10675ab3627ae.tar.gz
[hw3]
Diffstat (limited to 'hw3/plot.py')
-rw-r--r--hw3/plot.py18
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")