forked from SylvanHuang/RecSys
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
105 lines (89 loc) · 2.83 KB
/
main.py
File metadata and controls
105 lines (89 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
import method
def test100k_explicit():
test_count = 5
evaluation_base = 2
ans = [0] * evaluation_base
for k in xrange(1, test_count + 1):
method.generate_data_100k_explicit(k)
method.generate_matrix(implicit=False)
b = method.evaluate_explicit()
for x in xrange(evaluation_base):
ans[x] += b[x]
for x in xrange(evaluation_base):
ans[x] /= test_count
print ans
def test100k_implicit():
test_count = 5
evaluation_base = 4
ans = [0] * evaluation_base
for k in xrange(1, test_count + 1):
method.generate_data_100k_implicit(k)
method.generate_matrix(implicit=True)
b = method.evaluate_implicit()
for x in xrange(evaluation_base):
ans[x] += b[x]
for x in xrange(evaluation_base):
ans[x] /= test_count
print ans
def test1m_explicit():
test_count = 8
evaluation_base = 2
ans = [0] * evaluation_base
for k in xrange(test_count):
method.generate_data_1m_explicit(test_count, k)
method.generate_matrix(implicit=False)
b = method.evaluate_explicit()
for x in xrange(evaluation_base):
ans[x] += b[x]
for x in xrange(evaluation_base):
ans[x] /= test_count
print ans
def test1m_implicit():
test_count = 8
evaluation_base = 4
ans = [0] * evaluation_base
for k in xrange(test_count):
method.generate_data_1m_implicit(test_count, k)
method.generate_matrix(implicit=True)
b = method.evaluate_implicit()
for x in xrange(evaluation_base):
ans[x] += b[x]
for x in xrange(evaluation_base):
ans[x] /= test_count
print ans
def test_latest_small_explicit():
test_count = 8
evaluation_base = 2
ans = [0] * evaluation_base
for k in xrange(test_count):
method.generate_data_latest_small_explicit(test_count, k)
method.generate_matrix(implicit=False)
b = method.evaluate_explicit()
for x in xrange(evaluation_base):
ans[x] += b[x]
for x in xrange(evaluation_base):
ans[x] /= test_count
print ans
def test_latest_small_implicit():
test_count = 8
evaluation_base = 4
ans = [0] * evaluation_base
for k in xrange(test_count):
method.generate_data_latest_small_implicit(test_count, k)
method.generate_matrix(implicit=True)
b = method.evaluate_implicit()
for x in xrange(evaluation_base):
ans[x] += b[x]
for x in xrange(evaluation_base):
ans[x] /= test_count
print ans
if __name__ == '__main__':
test100k_explicit()
# test100k_implicit()
# test1m_explicit()
# test1m_implicit()
# test_latest_small_explicit()
# test_latest_small_implicit()