Commit 36261559 authored by 高雅喆's avatar 高雅喆

fix bug in eda/test/getTopFeatures.py with positional args

parent 6a65f4ae
......@@ -45,12 +45,12 @@ class TopFeatures(object):
imp_times = tuple2dict(con_sql(sql))
return imp_times
def get_result(self, clk, imp, clk_n=2, result_types="ctr"):
def get_result(self, clk={}, imp={}, clk_n=2, result_types="ctr"):
"""
result_types : "clk";"imp";"ctr"
clk : dict
imp : dict
clk_n : 获取topN点击率时,过滤的点击数
result_types : "clk";"imp";"ctr"
rtype : list
"""
topn = []
......@@ -111,18 +111,18 @@ class TopFeatures(object):
def main():
top_diary = TopFeatures(1, "all", "diary")
top_diary = TopFeatures(1, "all", "diary", 100)
clk_diary_times_all = top_diary.get_click_times()
imp_diary_times_all = top_diary.get_impression_times()
clk_diary_ctr_all = top_diary.get_result("ctr", clk_diary_times_all, imp_diary_times_all, top_n=100)
clk_diary_ctr_all = top_diary.get_result(clk_diary_times_all, imp_diary_times_all, 4, "ctr")
clk_diary_times_ios = top_diary.get_click_times()
imp_diary_times_ios = top_diary.get_impression_times()
clk_diary_ctr_ios = top_diary.get_result("ctr", clk_diary_times_ios, imp_diary_times_ios, top_n=100)
clk_diary_ctr_ios = top_diary.get_result(clk_diary_times_ios, imp_diary_times_ios, 4, "ctr")
clk_diary_times_android = top_diary.get_click_times()
imp_diary_times_android = top_diary.get_impression_times()
clk_diary_ctr_android = top_diary.get_result("ctr", clk_diary_times_android, imp_diary_times_android, top_n=100)
clk_diary_ctr_android = top_diary.get_result(clk_diary_times_android, imp_diary_times_android, 4, "ctr")
result_lst = [clk_diary_ctr_all, clk_diary_ctr_ios, clk_diary_ctr_android]
output_path = DIRECTORY_PATH + "5top100_ctr_diary_%s.txt"
......
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