MCPcopy Create free account
hub / github.com/lazyprogrammer/machine_learning_examples / get_loss

Function get_loss

recommenders/mf2.py:79–88  ·  view source on GitHub ↗
(m2u)

Source from the content-addressed store, hash-verified

77
78
79def get_loss(m2u):
80 # d: movie_id -> (user_ids, ratings)
81 N = 0.
82 sse = 0
83 for j, (u_ids, r) in m2u.items():
84 p = W[u_ids].dot(U[j]) + b[u_ids] + c[j] + mu
85 delta = p - r
86 sse += delta.dot(delta)
87 N += len(r)
88 return sse / N
89
90
91

Callers 1

mf2.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected