-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjunk.py
40 lines (35 loc) · 3.13 KB
/
junk.py
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
import numpy as np
import scipy.stats as stats
from collections import OrderedDict
"""
Plots the validation errors of AdaGrad vs Simple Gradient Descent
import matplotlib.pyplot as plt
arr_adagrad = [224.92294552003872, 225.50094851173731, 240.25502730902008, 210.03034852863044, 215.45568726455852, 215.11145006468053, 214.12693063707556, 215.63097288006261, 214.4976095661724, 219.88921919543145, 240.82182565271995, 225.0939878619152, 234.07033178085183, 237.49361495138777, 242.12837325439736, 227.68276992662683, 254.88472966968362, 259.89918785980478, 252.70451576246228, 265.01894149213257, 263.87063484854974, 283.35331114606703, 300.71495234374009, 309.99862967678473, 293.64954392315639, 306.47665692427563, 335.99267184838828, 323.68186155011352, 320.76865900512729, 357.42543610628627, 329.92663008510209, 353.62639923858114, 346.85609828769503, 346.86614555445306, 362.23356994231688, 398.01719648176231, 392.58443111600445, 399.63070752173593, 420.40605943748335, 433.83982729614308, 433.53231627882332, 409.83193021173935, 418.51842748846042, 426.19391966273133]
arr_simple = [215.21960860315315, 214.36455519008413, 212.84058279823108, 212.06993488701704, 210.62058343399298, 210.25333522597063, 210.41264601663727, 209.65764134931044, 209.52922425963294, 208.47443593040308, 208.21968564194765, 209.95915807835837, 207.87653929016375, 208.11704029735264, 207.87439090571996, 207.79755920070454, 208.38320454397785, 206.69118488117979, 207.30065487423823, 206.87559544689157, 208.40959105196933, 206.3021897221781, 208.64022139973926, 208.72690578041792, 212.11623733095837, 206.29225740357532, 208.67483793491388, 208.32167611844383, 210.09866359591203, 212.53155293760702, 210.53982095392956, 211.23538385162263, 213.07148953874366, 218.4259618163847, 216.34756108666556, 218.60017906250195, 217.354682024895, 219.83506241457897, 220.81611358414978, 217.49708127010774, 224.41842429500036, 219.79240879827898, 223.01726755385306, 223.92014585571241, 218.04467238024543, 219.81982745688552, 239.24195797648792, 223.47236047566633, 223.44585494948609, 232.72695850909858, 231.44601691660108, 228.36390436651229, 230.64305619916789, 230.26586539635323, 233.72129361464067, 230.11960990811227, 249.03720779195083, 231.45991566122703, 240.57760093892023, 243.20606289870295, 243.47343499491404, 244.34268676445342]
plt.plot(arr_adagrad, c='g', label='AdaGrad')
plt.hold('on')
plt.plot(arr_simple, c='r', label='Simple')
plt.xlabel('Iteration')
plt.ylabel('Costs')
plt.title('Validation Cost')
plt.legend()
plt.show()
"""
'''
Calculates the result of batch award polls
data = np.genfromtxt('batch_titles_poll.csv', dtype=None, delimiter=',')
awards_num = data.shape[1]
awards = {}
for i in xrange(3, awards_num):
awards[data[0, i]] = {}
details = stats.itemfreq(data[1:, i])
for name, count in details:
awards[data[0, i]][name] = int(count)
awards[data[0, i]] = OrderedDict(sorted(awards[data[0, i]].items(), key=lambda x: x[1], reverse=True))
with open("results_poll.txt", "w") as f:
for title, details in awards.items():
f.write(title + "\n")
for name, count in details.items():
f.write(name + "\t" + "\n")
f.write("\n")
'''