def containsItem(self,i):
"whether item is in training set"
return self.trainingMatrix.matrix_Item.has_key(self.getItemId(i))
def userRated(self,u):
if self.trainingMatrix.matrix_User.has_key(self.getUserId(u)):
itemIndex = self.trainingMatrix.matrix_User[self.user[u]].keys()
After Change
def containsItem(self,i):
"whether item is in training set"
if self.item.has_key(i):
return True
else:
return False
def userRated(self,u):
return self.trainSet_u[u].keys(),self.trainSet_u[u].values()
def itemRated(self,i):