Commit a039bf1c authored by 段英荣's avatar 段英荣

调试

parent 4fda1db2
...@@ -14,6 +14,7 @@ import json ...@@ -14,6 +14,7 @@ import json
import pickle import pickle
import pymysql import pymysql
import random import random
import time
redis_url = "redis://:ReDis!GmTx*0aN9@172.16.40.173:6379" redis_url = "redis://:ReDis!GmTx*0aN9@172.16.40.173:6379"
...@@ -91,10 +92,10 @@ class LinUCB: ...@@ -91,10 +92,10 @@ class LinUCB:
tag_id = tag_list[top_score_index] tag_id = tag_list[top_score_index]
top_tag_dict[tag_id] = top_score top_tag_dict[tag_id] = top_score
top_tag_set.add(tag_id) top_tag_set.add(tag_id)
if len(top_tag_dict) >= 1000: if len(top_tag_dict) >= 20:
break break
if len(top_tag_dict) >= 1000: if len(top_tag_dict) >= 20:
break break
return (top_tag_dict,top_tag_set) return (top_tag_dict,top_tag_set)
...@@ -225,6 +226,8 @@ if __name__ == "__main__": ...@@ -225,6 +226,8 @@ if __name__ == "__main__":
test_user_feature = [1, 2, 1, 1, 3, 1] test_user_feature = [1, 2, 1, 1, 3, 1]
begin=time.time()
all_diary_content_redis_dict = redis_client.hgetall("strategy:linucb:content_type:diary") all_diary_content_redis_dict = redis_client.hgetall("strategy:linucb:content_type:diary")
top_tag_dict, top_tag_set = LinUCB.linucb_recommend_tag(all_diary_content_redis_dict,test_user_feature,list(all_diary_content_redis_dict.keys())) top_tag_dict, top_tag_set = LinUCB.linucb_recommend_tag(all_diary_content_redis_dict,test_user_feature,list(all_diary_content_redis_dict.keys()))
print(time.time()-begin)
print(top_tag_dict) print(top_tag_dict)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment