if niter == 0: fitold = fit
fitchange = abs(fitold - fit)
fitold = fit
if verbose == True:
print("Iteration: %s fit: %s, fitchange: %s" %(niter, fit, fitchange))
After Change
fit = []
for niter in range(maxiter):
violation = 0.0
// Pointer to updated factor matrix
if niter != 0: W = Wtemp
// Update factor matrix H
WtW = W.T.dot(W)
AtW = A.T.dot(W)
violation += _rfhals_update(Ht, WtW, AtW)
Ht /= sci.maximum(epsi, sci.linalg.norm(Ht, axis=0))
// Update factor matrix W
HHt = Ht.T.dot(Ht)
AHt = Q.dot(A.dot(Ht)) // Rotate AHt back to high-dimensional space
W = Q.dot(W) // Rotate W back to high-dimensional space
violation += _rfhals_update(W, HHt, AHt)
print(violation)
// Project W to low-dimensional space
Wtemp = Q.T.dot(W)