MCPcopy Create free account
hub / github.com/rushter/MLAlgorithms / moving_average

Function moving_average

examples/rbm.py:13–16  ·  view source on GitHub ↗
(a, n=25)

Source from the content-addressed store, hash-verified

11 from matplotlib import pyplot as plt
12
13 def moving_average(a, n=25):
14 ret = np.cumsum(a, dtype=float)
15 ret[n:] = ret[n:] - ret[:-n]
16 return ret[n - 1 :] / n
17
18 plt.plot(moving_average(rbm.errors))
19 plt.show()

Callers 1

print_curveFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected