Commit 0efaebd8 authored by 张彦钊's avatar 张彦钊

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

增加执行环境
parents 1d45c955 35b29f97
...@@ -20,7 +20,7 @@ def result2file(fpath): ...@@ -20,7 +20,7 @@ def result2file(fpath):
内容概览:以下所有数据都是首页的 内容概览:以下所有数据都是首页的
1. 比例特征 1. 比例特征
1.1 answer曝光占比(=answer被曝光数/总cid被曝光数) 1.1 answer曝光占比(=answer被曝光数/总cid被曝光数)
1.2 活跃用户点击率(=活跃用户点击次数/活跃用户曝光次数) 1.2 活跃用户点击率(=有点击用户点击次数/有点击用户曝光次数)
1.3 点击answer用户占比(=点击answer用户数/曝光answer用户数) 1.3 点击answer用户占比(=点击answer用户数/曝光answer用户数)
1.4 点击diary用户占比(=点击diary用户数/曝光diary用户数) 1.4 点击diary用户占比(=点击diary用户数/曝光diary用户数)
1.5 无点击用户占比(=无点击用户数/有曝光用户数) 1.5 无点击用户占比(=无点击用户数/有曝光用户数)
...@@ -28,7 +28,7 @@ def result2file(fpath): ...@@ -28,7 +28,7 @@ def result2file(fpath):
2.1 用户点击次数分布(第一列:用户点击次数;第二列:独立用户数量) 2.1 用户点击次数分布(第一列:用户点击次数;第二列:独立用户数量)
2.2 Top 100 diary (sorted by ctr) 2.2 Top 100 diary (sorted by ctr)
2.3 Top 100 Answer (sorted by ctr) 2.3 Top 100 Answer (sorted by ctr)
2.4 Top 100 Question (sorted by click times) 2.4 Top 100 Question (sorted by ctr)
...@@ -49,7 +49,7 @@ def result2file(fpath): ...@@ -49,7 +49,7 @@ def result2file(fpath):
f.write('\n') f.write('\n')
print("1.1已将answer曝光占比存入文件") print("1.1已将answer曝光占比存入文件")
f.write("#1.2活跃用户点击率(=活跃用户点击次数/活跃用户曝光次数)\n") f.write("#1.2活跃用户点击率(=有点击用户点击次数/有点击用户曝光次数)\n")
f.write(tplt.format("平台","active用户点击次数","active用户曝光次数","active用户点击率")) f.write(tplt.format("平台","active用户点击次数","active用户曝光次数","active用户点击率"))
all_click_one_rate = get_all_click_one_rate() all_click_one_rate = get_all_click_one_rate()
ios_click_one_rate = get_ios_click_one_rate() ios_click_one_rate = get_ios_click_one_rate()
......
...@@ -21,7 +21,7 @@ def tuple2dict(tuple_result): ...@@ -21,7 +21,7 @@ def tuple2dict(tuple_result):
def result2file(result_lst,fpath): def result2file(result_lst,fpath):
with open(fpath,'w') as f: with open(fpath,'w') as f:
tplt = "{0:\u3000<4}\t{1:\u3000<12}\t{2:\u3000^6}\t{3:\u3000^6}\t{4:\u3000<8}\t{5:\u3000^15}\n" tplt = "{0:\u3000<4}\t{1:\u3000<12}\t{2:\u3000^6}\t{3:\u3000^6}\t{4:\u3000<8}\t{5:\u3000^15}\n"
f.write("2.4 Top 100 Question(曝光表里cid类型没有question,因此下面的曝光数和点击率都为0)\n") f.write("2.4 Top 100 Question\n")
f.write("=================================================================\n") f.write("=================================================================\n")
f.write(tplt.format("平台","question_id","点击数","曝光数","点击率","question链接")) f.write(tplt.format("平台","question_id","点击数","曝光数","点击率","question链接"))
for i in result_lst: for i in result_lst:
......
...@@ -29,6 +29,7 @@ def main(): ...@@ -29,6 +29,7 @@ def main():
activate_uid_ctr_all = get_activate_uid_ctr("all") activate_uid_ctr_all = get_activate_uid_ctr("all")
activate_uid_ctr_ios = get_activate_uid_ctr("ios") activate_uid_ctr_ios = get_activate_uid_ctr("ios")
activate_uid_ctr_android = get_activate_uid_ctr("android") activate_uid_ctr_android = get_activate_uid_ctr("android")
activate_uid_ctr_result = [activate_uid_ctr_all,activate_uid_ctr_ios,activate_uid_ctr_android]
print("已获取活跃用户点击率") print("已获取活跃用户点击率")
#1.4 点击answer用户占比(=点击answer用户数/曝光answer用户数) #1.4 点击answer用户占比(=点击answer用户数/曝光answer用户数)
...@@ -79,7 +80,7 @@ def main(): ...@@ -79,7 +80,7 @@ def main():
output_path = DIRECTORY_PATH + "result_{}.txt".format(get_yesterday_date()) output_path = DIRECTORY_PATH + "result_{}.txt".format(get_yesterday_date())
with open(output_path, 'w') as f: with open(output_path, 'w') as f:
......
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