Commit c3106702 authored by 张彦钊's avatar 张彦钊

Merge branch 'master' of git.wanmeizhensuo.com:ML/ffm-baseline

add print
parents 94a4223f 7e9d63c9
......@@ -61,7 +61,7 @@ class TopFeatures(object):
url = "http://m.igengmei.com/diary_book/" + i[i.index('|')+1:] + '/'
else:
url = "http://m.igengmei.com/{0}/".format(self.cid_type) + i[i.index('|')+1:] + '/'
topn.append((self.cid_type.strip(),i,clk[i],0,0,url))
topn.append((self.platform.strip(),i,clk[i],0,0,url))
topn.sort(key=lambda x:x[2],reverse=True)
return topn[:int(self.top_n)]
#获取topN的曝光
......@@ -71,7 +71,7 @@ class TopFeatures(object):
url = "http://m.igengmei.com/diary_book/" + i[i.index('|')+1:] + '/'
else:
url = "http://m.igengmei.com/{0}/".format(self.cid_type) + i[i.index('|')+1:] + '/'
topn.append((self.cid_type.strip(),i,0,imp[i],0,url))
topn.append((self.platform.strip(),i,0,imp[i],0,url))
topn.sort(key=lambda x:x[3],reverse=True)
return topn[:int(self.top_n)]
#获取topN的ctr
......@@ -82,7 +82,7 @@ class TopFeatures(object):
url = "http://m.igengmei.com/diary_book/" + i[i.index('|')+1:] + '/'
else:
url = "http://m.igengmei.com/{0}/".format(self.cid_type) + i[i.index('|')+1:] + '/'
topn.append((self.cid_type.strip(),i,clk[i],imp[i],round(clk[i]/imp[i],4),url))
topn.append((self.platform.strip(),i,clk[i],imp[i],round(clk[i]/imp[i],4),url))
topn.sort(key=lambda x:x[4],reverse=True)
return topn[:int(self.top_n)]
......@@ -125,7 +125,7 @@ def main():
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"
output_path = DIRECTORY_PATH + "5top100_ctr_diary_%s.txt".format(get_yesterday_date())
top_diary.result2file(result_lst, output_path)
......
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