Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
ffm-baseline
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ML
ffm-baseline
Commits
1caba335
Commit
1caba335
authored
Aug 16, 2018
by
张彦钊
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of git.wanmeizhensuo.com:ML/ffm-baseline
add multi get_eachCityDiaryTop3000
parents
e72f288f
399e04ee
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
21 deletions
+34
-21
getClickZeroUidRateDetail.py
eda/recommended_indexs/getClickZeroUidRateDetail.py
+15
-4
getRate.py
eda/recommended_indexs/getRate.py
+19
-17
No files found.
eda/recommended_indexs/getClickZeroUidRateDetail.py
View file @
1caba335
...
@@ -128,11 +128,22 @@ def get_rate_detail(platform):
...
@@ -128,11 +128,22 @@ def get_rate_detail(platform):
db
.
close
()
db
.
close
()
return
result
return
result
def
result2dict
(
result
):
"""
result : tuple2
rtype : dict
"""
dct
=
{}
sum_count
=
0
for
i
in
result
:
sum_count
+=
i
[
1
]
for
i
in
result
:
dct
[
i
[
0
]]
=
"{}
%
"
.
format
(
round
(
i
[
1
]
/
sum_count
*
100
,
2
))
return
dct
no_click_uid_detail_all
=
result2dict
(
get_rate_detail
(
"all"
))
no_click_uid_detail_all
=
get_rate_detail
(
"all"
)
no_click_uid_detail_ios
=
result2dict
(
get_rate_detail
(
"ios"
))
no_click_uid_detail_ios
=
get_rate_detail
(
"ios"
)
no_click_uid_detail_android
=
result2dict
(
get_rate_detail
(
"android"
))
no_click_uid_detail_android
=
get_rate_detail
(
"android"
)
...
...
eda/recommended_indexs/getRate.py
View file @
1caba335
...
@@ -18,14 +18,16 @@ def result2file(fpath):
...
@@ -18,14 +18,16 @@ def result2file(fpath):
with
open
(
fpath
,
'w'
)
as
f
:
with
open
(
fpath
,
'w'
)
as
f
:
tplt
=
"{0:
\u3000
<6}
\t
{1:
\u3000
<15}
\t
{2:
\u3000
<15}
\t
{3:
\u3000
<15}
\n
"
tplt
=
"{0:
\u3000
<6}
\t
{1:
\u3000
<15}
\t
{2:
\u3000
<15}
\t
{3:
\u3000
<15}
\n
"
line
=
"""数据日期:{}
line
=
"""数据日期:{}
内容概览:以下所有数据都是首页的
内容概览:以下所有数据都是
昨天一天的
首页的
1. 比例特征
1. 比例特征
1.1 answer曝光占比(=answer被曝光数/总cid被曝光数)
1.1 answer曝光占比(=answer被曝光数/总cid被曝光数)
1.2 diary曝光占比(=diary被曝光数/总cid被曝光数)
1.2 diary曝光占比(=diary被曝光数/总cid被曝光数)
1.3 活跃用户点击率(=有点击用户点击次数/有点击用户曝光次数)
1.3 活跃用户点击率(=有点击用户点击次数/有点击用户曝光次数)
1.4 点击answer用户占比(=点击answer用户数/曝光answer用户数)
1.4 活跃用户平均每天曝光次数(活跃用户指的是有点击的用户)
1.5 点击diary用户占比(=点击diary用户数/曝光diary用户数)
1.5 点击answer用户占比(=点击answer用户数/曝光answer用户数)
1.6 无点击用户占比(=无点击用户数/有曝光用户数)
1.6 点击diary用户占比(=点击diary用户数/曝光diary用户数)
1.7 无点击用户占比(=无点击用户数/有曝光用户数)
1.8 无点击用户数分布占比(根据激活日期和平台来分)
2.Top特征
2.Top特征
2.1 用户点击次数分布(第一列:用户点击次数;第二列:独立用户数量)
2.1 用户点击次数分布(第一列:用户点击次数;第二列:独立用户数量)
2.2 Top 100 diary (sorted by ctr)
2.2 Top 100 diary (sorted by ctr)
...
@@ -34,7 +36,7 @@ def result2file(fpath):
...
@@ -34,7 +36,7 @@ def result2file(fpath):
具体内容:以下所有数据都
是
首页的
具体内容:以下所有数据都
昨天一天的
首页的
"""
.
format
(
get_yesterday_date
())
"""
.
format
(
get_yesterday_date
())
f
.
write
(
line
)
f
.
write
(
line
)
f
.
write
(
"#1. 比例特征
\n
"
)
f
.
write
(
"#1. 比例特征
\n
"
)
...
@@ -46,7 +48,7 @@ def result2file(fpath):
...
@@ -46,7 +48,7 @@ def result2file(fpath):
android_answer_imp_rate
=
get_android_answer_imp_rate
()
android_answer_imp_rate
=
get_android_answer_imp_rate
()
lst
=
[
all_answer_imp_rate
,
ios_answer_imp_rate
,
android_answer_imp_rate
]
lst
=
[
all_answer_imp_rate
,
ios_answer_imp_rate
,
android_answer_imp_rate
]
for
i
in
lst
:
for
i
in
lst
:
line
=
tplt
.
format
(
i
[
0
],
i
[
1
],
i
[
2
],
i
[
3
]
)
line
=
tplt
.
format
(
i
[
0
],
i
[
1
],
i
[
2
],
"{}
%
"
.
format
(
round
(
i
[
3
]
*
100
,
2
))
)
f
.
write
(
line
)
f
.
write
(
line
)
f
.
write
(
'
\n
'
)
f
.
write
(
'
\n
'
)
print
(
"1.1已将answer曝光占比存入文件"
)
print
(
"1.1已将answer曝光占比存入文件"
)
...
@@ -58,7 +60,7 @@ def result2file(fpath):
...
@@ -58,7 +60,7 @@ def result2file(fpath):
android_diary_imp_rate
=
get_android_diary_imp_rate
()
android_diary_imp_rate
=
get_android_diary_imp_rate
()
lst
=
[
all_diary_imp_rate
,
ios_diary_imp_rate
,
android_diary_imp_rate
]
lst
=
[
all_diary_imp_rate
,
ios_diary_imp_rate
,
android_diary_imp_rate
]
for
i
in
lst
:
for
i
in
lst
:
line
=
tplt
.
format
(
i
[
0
],
i
[
1
],
i
[
2
],
i
[
3
]
)
line
=
tplt
.
format
(
i
[
0
],
i
[
1
],
i
[
2
],
"{}
%
"
.
format
(
round
(
i
[
3
]
*
100
,
2
))
)
f
.
write
(
line
)
f
.
write
(
line
)
f
.
write
(
'
\n
'
)
f
.
write
(
'
\n
'
)
print
(
"1.2已将diary曝光占比存入文件"
)
print
(
"1.2已将diary曝光占比存入文件"
)
...
@@ -70,46 +72,46 @@ def result2file(fpath):
...
@@ -70,46 +72,46 @@ def result2file(fpath):
android_click_one_rate
=
get_android_click_one_rate
()
android_click_one_rate
=
get_android_click_one_rate
()
lst
=
[
all_click_one_rate
,
ios_click_one_rate
,
android_click_one_rate
]
lst
=
[
all_click_one_rate
,
ios_click_one_rate
,
android_click_one_rate
]
for
i
in
lst
:
for
i
in
lst
:
line
=
tplt
.
format
(
i
[
0
],
i
[
1
],
i
[
2
],
i
[
3
]
)
line
=
tplt
.
format
(
i
[
0
],
i
[
1
],
i
[
2
],
"{}
%
"
.
format
(
round
(
i
[
3
]
*
100
,
2
))
)
f
.
write
(
line
)
f
.
write
(
line
)
f
.
write
(
'
\n
'
)
f
.
write
(
'
\n
'
)
print
(
"1.3已将活跃用户点击率存入文件"
)
print
(
"1.3已将活跃用户点击率存入文件"
)
f
.
write
(
"#1.
4
点击answer用户占比(=点击answer用户数/曝光answer用户数)
\n
"
)
f
.
write
(
"#1.
5
点击answer用户占比(=点击answer用户数/曝光answer用户数)
\n
"
)
f
.
write
(
tplt
.
format
(
"平台"
,
"点击answer用户数"
,
"曝光answer用户数"
,
"击answer用户占比"
))
f
.
write
(
tplt
.
format
(
"平台"
,
"点击answer用户数"
,
"曝光answer用户数"
,
"击answer用户占比"
))
all_click_answer_rate
=
get_all_click_answer_rate
()
all_click_answer_rate
=
get_all_click_answer_rate
()
ios_click_answer_rate
=
get_ios_click_answer_rate
()
ios_click_answer_rate
=
get_ios_click_answer_rate
()
android_click_answer_rate
=
get_android_click_answer_rate
()
android_click_answer_rate
=
get_android_click_answer_rate
()
lst
=
[
all_click_answer_rate
,
ios_click_answer_rate
,
android_click_answer_rate
]
lst
=
[
all_click_answer_rate
,
ios_click_answer_rate
,
android_click_answer_rate
]
for
i
in
lst
:
for
i
in
lst
:
line
=
tplt
.
format
(
i
[
0
],
i
[
1
],
i
[
2
],
i
[
3
]
)
line
=
tplt
.
format
(
i
[
0
],
i
[
1
],
i
[
2
],
"{}
%
"
.
format
(
round
(
i
[
3
]
*
100
,
2
))
)
f
.
write
(
line
)
f
.
write
(
line
)
f
.
write
(
'
\n
'
)
f
.
write
(
'
\n
'
)
print
(
"1.
4
已将点击answer用户占比存入文件"
)
print
(
"1.
5
已将点击answer用户占比存入文件"
)
f
.
write
(
"#1.
5
点击diary用户占比(=点击diary用户数/曝光diary用户数)
\n
"
)
f
.
write
(
"#1.
6
点击diary用户占比(=点击diary用户数/曝光diary用户数)
\n
"
)
f
.
write
(
tplt
.
format
(
"平台"
,
"点击diary用户数"
,
"曝光diary用户数"
,
"击diary用户占比"
))
f
.
write
(
tplt
.
format
(
"平台"
,
"点击diary用户数"
,
"曝光diary用户数"
,
"击diary用户占比"
))
all_click_diary_rate
=
get_all_click_diary_rate
()
all_click_diary_rate
=
get_all_click_diary_rate
()
ios_click_diary_rate
=
get_ios_click_diary_rate
()
ios_click_diary_rate
=
get_ios_click_diary_rate
()
android_click_diary_rate
=
get_android_click_diary_rate
()
android_click_diary_rate
=
get_android_click_diary_rate
()
lst
=
[
all_click_diary_rate
,
ios_click_diary_rate
,
android_click_diary_rate
]
lst
=
[
all_click_diary_rate
,
ios_click_diary_rate
,
android_click_diary_rate
]
for
i
in
lst
:
for
i
in
lst
:
line
=
tplt
.
format
(
i
[
0
],
i
[
1
],
i
[
2
],
i
[
3
]
)
line
=
tplt
.
format
(
i
[
0
],
i
[
1
],
i
[
2
],
"{}
%
"
.
format
(
round
(
i
[
3
]
*
100
,
2
))
)
f
.
write
(
line
)
f
.
write
(
line
)
f
.
write
(
'
\n
'
)
f
.
write
(
'
\n
'
)
print
(
"1.
5
已将点击diary用户占比存入文件"
)
print
(
"1.
6
已将点击diary用户占比存入文件"
)
f
.
write
(
"#1.
6
无点击用户占比(=无点击用户数/有曝光用户数)
\n
"
)
f
.
write
(
"#1.
7
无点击用户占比(=无点击用户数/有曝光用户数)
\n
"
)
f
.
write
(
tplt
.
format
(
"平台"
,
"no点击用户数"
,
"have曝光用户数"
,
"no点击用户占比"
))
f
.
write
(
tplt
.
format
(
"平台"
,
"no点击用户数"
,
"have曝光用户数"
,
"no点击用户占比"
))
all_click_zero_rate
=
get_all_click_zero_rate
()
all_click_zero_rate
=
get_all_click_zero_rate
()
ios_click_zero_rate
=
get_ios_click_zero_rate
()
ios_click_zero_rate
=
get_ios_click_zero_rate
()
android_click_zero_rate
=
get_android_click_zero_rate
()
android_click_zero_rate
=
get_android_click_zero_rate
()
lst
=
[
all_click_zero_rate
,
ios_click_zero_rate
,
android_click_zero_rate
]
lst
=
[
all_click_zero_rate
,
ios_click_zero_rate
,
android_click_zero_rate
]
for
i
in
lst
:
for
i
in
lst
:
line
=
tplt
.
format
(
i
[
0
],
i
[
1
],
i
[
2
],
i
[
3
]
)
line
=
tplt
.
format
(
i
[
0
],
i
[
1
],
i
[
2
],
"{}
%
"
.
format
(
round
(
i
[
3
]
*
100
,
2
))
)
f
.
write
(
line
)
f
.
write
(
line
)
f
.
write
(
'
\n
'
)
f
.
write
(
'
\n
'
)
print
(
"1.
6
已将无点击用户占比存入文件"
)
print
(
"1.
7
已将无点击用户占比存入文件"
)
def
main
():
def
main
():
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment