示例#1
0
文件: test.py 项目: donaldhuan/rec
 def testMain(self):
     for i in range(0, 1000):
         u = int(random() * N_USER + 1)
         v = int(random() * N_USER + 1)
         self.assertTrue(abs(algorithm.sim(u, v) - algorithm_hjw.sim(u, v)) < 0.01)
示例#2
0
文件: cache.py 项目: donaldhuan/rec
from config import USER_NUM
from algorithm import sim
import sqlite3
conn = sqlite3.Connection('../recexpr.db')

for i in range(578, USER_NUM + 1):
    for j in range(i + 1, USER_NUM + 1):
        conn.execute('INSERT INTO core_similarity VALUES(%d, %f)' % (i * 1000 + j, sim(i, j)))
        conn.commit()
        print i, j