f3fbdef37a98ef1cab7163f01f00eaccb563771c,algorithm/rating/SVD.py,SVD,buildModel,#SVD#,13

Before Change


            self.loss = 0
            for triple in self.dao.triple:
                u,i,r = triple
                u = self.dao.user[u]
                i = self.dao.item[i]
                error = r-self.P[u].dot(self.Q[i])-self.dao.globalMean-self.Bi[i]-self.Bu[u]
                self.loss+=error**2
                //update latent vectors

After Change


            self.loss = 0
            for triple in self.dao.triple:
                u,i,r = triple
                u = self.dao.getUserId(u)
                i = self.dao.getItemId(i)
                error = r-self.P[u].dot(self.Q[i])-self.dao.globalMean-self.Bi[i]-self.Bu[u]
                self.loss+=error**2
                p = self.P[u].copy()
                q = self.Q[i].copy()
                self.loss += self.regU * p.dot(p) + self.regI * q.dot(q)
                bu = self.Bu[u]
                bi = self.Bi[i]
                self.loss += self.regB*bu**2 + self.regB*bi**2
                //update latent vectors
                self.P[u] = p+self.lRate*(error*q-self.regU*p)
                self.Q[i] = q+self.lRate*(error*p-self.regI*q)
                self.Bu[u] = bu+self.lRate*(error-self.regB*bu)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: Coder-Yu/RecQ
Commit Name: f3fbdef37a98ef1cab7163f01f00eaccb563771c
Time: 2016-11-24
Author: coderyy@outlook.com
File Name: algorithm/rating/SVD.py
Class Name: SVD
Method Name: buildModel


Project Name: Coder-Yu/RecQ
Commit Name: f3fbdef37a98ef1cab7163f01f00eaccb563771c
Time: 2016-11-24
Author: coderyy@outlook.com
File Name: algorithm/rating/SVD.py
Class Name: SVD
Method Name: predict


Project Name: Coder-Yu/RecQ
Commit Name: f3fbdef37a98ef1cab7163f01f00eaccb563771c
Time: 2016-11-24
Author: coderyy@outlook.com
File Name: algorithm/rating/BasicMF.py
Class Name: BasicMF
Method Name: buildModel