MCPcopy Index your code
hub / github.com/ujjwalkarn/DataSciencePython / update_w

Function update_w

Logistic-Regression/citreo.py:84–92  ·  view source on GitHub ↗
(w, n, x, p, y)

Source from the content-addressed store, hash-verified

82# w: updated model
83# n: updated count
84def update_w(w, n, x, p, y):
85 for i in x:
86 # alpha / (sqrt(n) + 1) is the adaptive learning rate heuristic
87 # (p - y) * x[i] is the current gradient
88 # note that in our case, if i in x then x[i] = 1
89 w[i] -= (p - y) * alpha / (sqrt(n[i]) + 1.)
90 n[i] += 1.
91
92 return w, n
93
94
95# training and testing #######################################################

Callers 1

citreo.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected