def update(self,data):
        """
        update user/item factors using stochastic gradient ascent

        params:
          data : scipy csr sparse matrix containing user->(item,count)
          U    : user factors
          V    : item factors
          lbda : regularization constant lambda
          gamma: learning rate
        """
        for i in xrange(len(self.U)):
            dU = -self.lbda*self.U[i]
            f = self.precompute_f(data,i)
            for j in f:
                dV = self.lbda*self.V[j]-g(-f[j])
                for k in f:
                    dV += dg(f[j]-f[k])*(1/(1-g(f[k]-f[j]))-1/(1-g(f[j]-f[k])))*self.U[i]
                self.V[j] += self.gamma*dV
                dU += g(-f[j])*self.V[j]
                for k in f:
                    dU += (self.V[j]-self.V[k])*dg(f[k]-f[j])/(1-g(f[k]-f[j]))
            self.U[i] += self.gamma*dU
dataset/ETHPy150Open Mendeley/mrec/mrec/mf/climf.py/CLiMFRecommender.update/swapped operands of `-`