def predict(self,u,i):
itemDict = {}
// check if the user existed in trainSet or not
if self.dao.containsUser(u) == True:
for item in self.dao.row(u).valuse():
if item.values() > 0:
itemDict[item] = item.values()
else:
continue
Sum = 0
freqSum = 0
for item2 in itemDict.keys():
Sum = Sum + ((itemDict[item2] + self.diffAverage[u][item2]) * self.freq[u][item2])
freqSum = freqSum + self.freq[u][item2]
pred = Sum/freqSum
else:
pred = self.dao.itemMeans[u]