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

Method _factor_step

mla/fm.py:61–65  ·  view source on GitHub ↗
(self, loss)

Source from the content-addressed store, hash-verified

59 self._factor_step(loss)
60
61 def _factor_step(self, loss):
62 for ix, x in enumerate(self.X):
63 for i in range(self.n_features):
64 v_grad = loss[ix] * (x.dot(self.v).dot(x[i])[0] - self.v[i] * x[i] ** 2)
65 self.v[i] -= self.lr * v_grad + (2 * self.reg_v * self.v[i])
66
67 def _predict(self, X=None):
68 linear_output = np.dot(X, self.w)

Callers 1

_trainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected