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

Function update_w

Logistic-Regression/citreo_code_v2.py:68–76  ·  view source on GitHub ↗
(w, n, x, p, y)

Source from the content-addressed store, hash-verified

66# w: updated model
67# n: updated count
68def update_w(w, n, x, p, y):
69 for i in x:
70 # alpha / (sqrt(n) + 1) is the adaptive learning rate heuristic
71 # (p - y) * x[i] is the current gradient
72 # note that in our case, if i in x then x[i] = 1
73 w[i] -= (p - y) * alpha / (sqrt(n[i]) + 1.)
74 n[i] += 1.
75
76 return w, n
77
78
79# training and testing #######################################################

Callers 1

citreo_code_v2.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected