Beispiel #1
0
def get_errors(uid):
    result = []
    pdb = conn.execute('SELECT movie_id, rating FROM core_train WHERE user_id = %d' % uid).fetchall()
    for entry in pdb:
        try:
            e = guess(uid, entry[0]) - entry[1]
            result.append(e)
        except:
            pass
    return result
Beispiel #2
0
 def testMain(self):
     for i in range(0, 1000):
         u = int(random() * N_USER + 1)
         m = int(random() * N_MOVIE + 1)
         self.assertTrue(abs(algorithm.guess(u, m) - algorithm_hjw.guess(u, m)) < 0.01, msg = (u, m))