예제 #1
0
 def updateParameters(self, articlePicked_FeatureVector, click):
     additionalFeatureVector = vectorize(
         np.outer(self.userFeature, articlePicked_FeatureVector))
     LinUCBUserStruct.updateParameters(self, articlePicked_FeatureVector,
                                       click)
     self.B += np.outer(articlePicked_FeatureVector,
                        additionalFeatureVector)
예제 #2
0
파일: LinUCB.py 프로젝트: qw2ky/LastFMExp
	def getProb(self, alpha, article_FeatureVector,userID):
		x = article_FeatureVector
		z = vectorize(np.outer(self.users[userID].userFeature, article_FeatureVector))
		temp =np.dot(np.dot(np.dot( self.A_zInv , np.transpose( self.users[userID].B)) , self.users[userID].AInv), x )
		mean = np.dot(self.users[userID].UserTheta,  x)+ np.dot(self.beta, z)
		s_t = np.dot(np.dot(z, self.A_zInv),  z) + np.dot(np.dot(x, self.users[userID].AInv),  x)
		-2* np.dot(z, temp)+ np.dot(np.dot( np.dot(x, self.users[userID].AInv) ,  self.users[userID].B ) ,temp)

		var = np.sqrt(s_t)
		pta = mean + alpha * var
		return pta
예제 #3
0
    def getProb(self, alpha, article_FeatureVector, userID):
        x = article_FeatureVector
        z = vectorize(
            np.outer(self.users[userID].userFeature, article_FeatureVector))
        temp = np.dot(
            np.dot(np.dot(self.A_zInv, np.transpose(self.users[userID].B)),
                   self.users[userID].AInv), x)
        mean = np.dot(self.users[userID].UserTheta, x) + np.dot(self.beta, z)
        s_t = np.dot(np.dot(z, self.A_zInv), z) + np.dot(
            np.dot(x, self.users[userID].AInv), x)
        -2 * np.dot(z, temp) + np.dot(
            np.dot(np.dot(x, self.users[userID].AInv), self.users[userID].B),
            temp)

        var = np.sqrt(s_t)
        pta = mean + alpha * var
        return pta
예제 #4
0
파일: LinUCB.py 프로젝트: qw2ky/LastFMExp
	def updateParameters(self, articlePicked_FeatureVector, click, userID):
		z = vectorize( np.outer(self.users[userID].userFeature, articlePicked_FeatureVector))

		temp = np.dot(np.transpose(self.users[userID].B), self.users[userID].AInv)

		self.A_z += np.dot(temp, self.users[userID].B)
		self.b_z +=np.dot(temp, self.users[userID].b)

		self.users[userID].updateParameters(articlePicked_FeatureVector, click)

		temp = np.dot(np.transpose(self.users[userID].B), self.users[userID].AInv)

		self.A_z = self.A_z + np.outer(z,z) - np.dot(temp, self.users[userID].B)
		self.b_z =self.b_z+ click*z - np.dot(temp, self.users[userID].b)
		self.A_zInv = np.linalg.inv(self.A_z)

		self.beta =np.dot(self.A_zInv, self.b_z)
		self.users[userID].updateTheta(self.beta)
예제 #5
0
    def updateParameters(self, articlePicked_FeatureVector, click, userID):
        z = vectorize(
            np.outer(self.users[userID].userFeature,
                     articlePicked_FeatureVector))

        temp = np.dot(np.transpose(self.users[userID].B),
                      self.users[userID].AInv)

        self.A_z += np.dot(temp, self.users[userID].B)
        self.b_z += np.dot(temp, self.users[userID].b)

        self.users[userID].updateParameters(articlePicked_FeatureVector, click)

        temp = np.dot(np.transpose(self.users[userID].B),
                      self.users[userID].AInv)

        self.A_z = self.A_z + np.outer(z, z) - np.dot(temp,
                                                      self.users[userID].B)
        self.b_z = self.b_z + click * z - np.dot(temp, self.users[userID].b)
        self.A_zInv = np.linalg.inv(self.A_z)

        self.beta = np.dot(self.A_zInv, self.b_z)
        self.users[userID].updateTheta(self.beta)
예제 #6
0
파일: LinUCB.py 프로젝트: qw2ky/LastFMExp
	def updateParameters(self, article_FeatureVector, click):
		additionalFeatureVector = vectorize(np.outer(self.userFeature, article_FeatureVector))
		LinUCBUserStruct.updateParameters(self, article_FeatureVector, click)
		self.B +=np.outer(article_FeatureVector, additionalFeatureVector)