Algorithm 1. Alternating optimization for matrix factorization. |
---|
Procedure MF(Ytr, k) 1. Initialize matrices U, V with values from unit normal distribution N(0, 1) 2. Choose a convergence threshold 3. while (prevIterLoss – IterLoss > threshold) do 4. if (odd iteration) then # update U in odd iterations 5. U = argmin Loss; given Ytr, V 6. else # update V in even iterations 7. V = argmin Loss; given Ytr, U 8. end if 9. end while 10. return U, V 11. end procedure |
Here . Note that this loss function does not contain squared terms. We have used this loss because it is faster to optimize and has the same properties as the loss function in equation (1); prevIterLoss = loss function value in previous iteration; IterLoss = loss function value in present iteration.
argmin: Minimization is done using the cvxopt function in the CVXPY toolbox. This function uses the stochastic gradient descent (SGD) method to find the global minimum of any convex function. cvxopt outputs the minimizer and the corresponding loss function value. If the loss function is non-decreasing over successive iterations, then the algorithm is considered to converge to an optimal solution. The entire implementation on our dataset is provided on Github.39