-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
40 lines (34 loc) · 1.04 KB
/
test.py
File metadata and controls
40 lines (34 loc) · 1.04 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
# -*- coding: utf-8 -*-
import sys
import json
sys.path.append("./")
from utils import EngineUtils
from engine.ttypes import UserProfile
from alg.alternatingLeastSquareAlgorithm import AlternatingLeastSquareAlgorithm
from alg.contentBasedAlgorithm import ContentBasedAlgorithm
from alg.popuBasedAlgorithm import PopuBasedAlgorithm
def TEST_ALS():
user = UserProfile(1, 3)
als = AlternatingLeastSquareAlgorithm()
print(als.Predict(user, 1))
print(als.Recommend(user))
def TEST_CONTENT():
user = UserProfile(1, 3)
alg = ContentBasedAlgorithm()
print(alg.Predict(user, 1))
print(alg.Recommend(user))
def TEST_POPU():
user = UserProfile(1, 3)
alg = PopuBasedAlgorithm()
print(alg.Predict(user, 1))
print(alg.Recommend(user))
def TEST_PARSER_JSON():
with open("conf/defaultEngineGroup.json") as file:
obj = json.load(file)
print(obj)
if __name__ == "__main__":
# EngineUtils().getSparkContext().setLogLevel("ERROR")
# TEST_ALS()
# TEST_CONTENT()
# TEST_POPU()
TEST_PARSER_JSON()