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
634de7a7
Commit
634de7a7
authored
Aug 09, 2018
by
高雅喆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change output file format with .format and fix start.sh cat command
parent
59409dca
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
46 additions
and
40 deletions
+46
-40
getActivateUidCtr.py
eda/recommended_indexs/code/getActivateUidCtr.py
+3
-3
getAnswerImpRate.py
eda/recommended_indexs/code/getAnswerImpRate.py
+3
-3
getClickAnswerUidRate.py
eda/recommended_indexs/code/getClickAnswerUidRate.py
+3
-3
getClickDiaryUidRate.py
eda/recommended_indexs/code/getClickDiaryUidRate.py
+3
-3
getClickZeroUidRate.py
eda/recommended_indexs/code/getClickZeroUidRate.py
+3
-3
getRate.py
eda/recommended_indexs/code/getRate.py
+8
-3
getTop100Answer.py
eda/recommended_indexs/code/getTop100Answer.py
+6
-6
getTop100Diary.py
eda/recommended_indexs/code/getTop100Diary.py
+6
-5
getTop100Question.py
eda/recommended_indexs/code/getTop100Question.py
+9
-9
start.sh
eda/recommended_indexs/code/start.sh
+2
-2
No files found.
eda/recommended_indexs/code/getActivateUidCtr.py
View file @
634de7a7
...
...
@@ -21,7 +21,7 @@ def get_all_click_one_rate():
impression_one_count
=
con_sql
(
sql
)
impression_one_count
=
impression_one_count
[
0
][
0
]
all_click_one_rate
=
click_one_count
/
impression_one_count
return
[
"
all
"
,
click_one_count
,
impression_one_count
,
round
(
all_click_one_rate
,
4
)]
return
[
"
所有
"
,
click_one_count
,
impression_one_count
,
round
(
all_click_one_rate
,
4
)]
...
...
@@ -35,7 +35,7 @@ def get_ios_click_one_rate():
impression_one_count
=
con_sql
(
sql
)
impression_one_count
=
impression_one_count
[
0
][
0
]
ios_click_one_rate
=
click_one_count
/
impression_one_count
return
[
"
ios
"
,
click_one_count
,
impression_one_count
,
round
(
ios_click_one_rate
,
4
)]
return
[
"
苹果
"
,
click_one_count
,
impression_one_count
,
round
(
ios_click_one_rate
,
4
)]
#3 获取安卓平台的有点击用户点击率
...
...
@@ -47,7 +47,7 @@ def get_android_click_one_rate():
impression_one_count
=
con_sql
(
sql
)
impression_one_count
=
impression_one_count
[
0
][
0
]
android_click_one_rate
=
click_one_count
/
impression_one_count
return
[
"
android
"
,
click_one_count
,
impression_one_count
,
round
(
android_click_one_rate
,
4
)]
return
[
"
安卓
"
,
click_one_count
,
impression_one_count
,
round
(
android_click_one_rate
,
4
)]
...
...
eda/recommended_indexs/code/getAnswerImpRate.py
View file @
634de7a7
...
...
@@ -21,7 +21,7 @@ def get_all_answer_imp_rate():
all_imp_count
=
con_sql
(
sql
)
all_imp_count
=
all_imp_count
[
0
][
0
]
all_answer_imp_rate
=
answer_imp_count
/
all_imp_count
return
[
"
all
"
,
answer_imp_count
,
all_imp_count
,
round
(
all_answer_imp_rate
,
4
)]
return
[
"
所有
"
,
answer_imp_count
,
all_imp_count
,
round
(
all_answer_imp_rate
,
4
)]
#2 获取ios平台的问答曝光占比
...
...
@@ -33,7 +33,7 @@ def get_ios_answer_imp_rate():
all_imp_count
=
con_sql
(
sql
)
all_imp_count
=
all_imp_count
[
0
][
0
]
ios_answer_imp_rate
=
answer_imp_count
/
all_imp_count
return
[
"
ios
"
,
answer_imp_count
,
all_imp_count
,
round
(
ios_answer_imp_rate
,
4
)]
return
[
"
苹果
"
,
answer_imp_count
,
all_imp_count
,
round
(
ios_answer_imp_rate
,
4
)]
#3 获取安卓平台的问答曝光占比
...
...
@@ -45,7 +45,7 @@ def get_android_answer_imp_rate():
all_imp_count
=
con_sql
(
sql
)
all_imp_count
=
all_imp_count
[
0
][
0
]
android_answer_imp_rate
=
answer_imp_count
/
all_imp_count
return
[
"
android
"
,
answer_imp_count
,
all_imp_count
,
round
(
android_answer_imp_rate
,
4
)]
return
[
"
安卓
"
,
answer_imp_count
,
all_imp_count
,
round
(
android_answer_imp_rate
,
4
)]
...
...
eda/recommended_indexs/code/getClickAnswerUidRate.py
View file @
634de7a7
...
...
@@ -21,7 +21,7 @@ def get_all_click_answer_rate():
impression_answer_count
=
con_sql
(
sql
)
impression_answer_count
=
impression_answer_count
[
0
][
0
]
all_click_answer_rate
=
click_answer_count
/
impression_answer_count
return
[
"
all
"
,
click_answer_count
,
impression_answer_count
,
round
(
all_click_answer_rate
,
4
)]
return
[
"
所有
"
,
click_answer_count
,
impression_answer_count
,
round
(
all_click_answer_rate
,
4
)]
...
...
@@ -34,7 +34,7 @@ def get_ios_click_answer_rate():
impression_answer_count
=
con_sql
(
sql
)
impression_answer_count
=
impression_answer_count
[
0
][
0
]
ios_click_answer_rate
=
click_answer_count
/
impression_answer_count
return
[
"
ios
"
,
click_answer_count
,
impression_answer_count
,
round
(
ios_click_answer_rate
,
4
)]
return
[
"
苹果
"
,
click_answer_count
,
impression_answer_count
,
round
(
ios_click_answer_rate
,
4
)]
...
...
@@ -48,7 +48,7 @@ def get_android_click_answer_rate():
impression_answer_count
=
con_sql
(
sql
)
impression_answer_count
=
impression_answer_count
[
0
][
0
]
android_click_answer_rate
=
click_answer_count
/
impression_answer_count
return
[
"
android
"
,
click_answer_count
,
impression_answer_count
,
round
(
android_click_answer_rate
,
4
)]
return
[
"
安卓
"
,
click_answer_count
,
impression_answer_count
,
round
(
android_click_answer_rate
,
4
)]
...
...
eda/recommended_indexs/code/getClickDiaryUidRate.py
View file @
634de7a7
...
...
@@ -21,7 +21,7 @@ def get_all_click_diary_rate():
impression_diary_count
=
con_sql
(
sql
)
impression_diary_count
=
impression_diary_count
[
0
][
0
]
all_click_diary_rate
=
click_diary_count
/
impression_diary_count
return
[
"
all
"
,
click_diary_count
,
impression_diary_count
,
round
(
all_click_diary_rate
,
4
)]
return
[
"
所有
"
,
click_diary_count
,
impression_diary_count
,
round
(
all_click_diary_rate
,
4
)]
...
...
@@ -34,7 +34,7 @@ def get_ios_click_diary_rate():
impression_diary_count
=
con_sql
(
sql
)
impression_diary_count
=
impression_diary_count
[
0
][
0
]
ios_click_diary_rate
=
click_diary_count
/
impression_diary_count
return
[
"
ios
"
,
click_diary_count
,
impression_diary_count
,
round
(
ios_click_diary_rate
,
4
)]
return
[
"
苹果
"
,
click_diary_count
,
impression_diary_count
,
round
(
ios_click_diary_rate
,
4
)]
#3 获取安卓平台的点击问答用户占比
...
...
@@ -46,7 +46,7 @@ def get_android_click_diary_rate():
impression_diary_count
=
con_sql
(
sql
)
impression_diary_count
=
impression_diary_count
[
0
][
0
]
android_click_diary_rate
=
click_diary_count
/
impression_diary_count
return
[
"
android
"
,
click_diary_count
,
impression_diary_count
,
round
(
android_click_diary_rate
,
4
)]
return
[
"
安卓
"
,
click_diary_count
,
impression_diary_count
,
round
(
android_click_diary_rate
,
4
)]
...
...
eda/recommended_indexs/code/getClickZeroUidRate.py
View file @
634de7a7
...
...
@@ -23,7 +23,7 @@ def get_all_click_zero_rate():
impression_zero_count
=
impression_zero_count
[
0
][
0
]
click_zero_count
=
impression_zero_count
-
click_zero_count
all_click_zero_rate
=
click_zero_count
/
impression_zero_count
return
[
"
all
"
,
click_zero_count
,
impression_zero_count
,
round
(
all_click_zero_rate
,
4
)]
return
[
"
所有
"
,
click_zero_count
,
impression_zero_count
,
round
(
all_click_zero_rate
,
4
)]
...
...
@@ -37,7 +37,7 @@ def get_ios_click_zero_rate():
impression_zero_count
=
impression_zero_count
[
0
][
0
]
click_zero_count
=
impression_zero_count
-
click_zero_count
ios_click_zero_rate
=
click_zero_count
/
impression_zero_count
return
[
"
ios
"
,
click_zero_count
,
impression_zero_count
,
round
(
ios_click_zero_rate
,
4
)]
return
[
"
苹果
"
,
click_zero_count
,
impression_zero_count
,
round
(
ios_click_zero_rate
,
4
)]
#3 获取安卓平台的0点击用户占比
...
...
@@ -50,7 +50,7 @@ def get_android_click_zero_rate():
impression_zero_count
=
impression_zero_count
[
0
][
0
]
click_zero_count
=
impression_zero_count
-
click_zero_count
android_click_zero_rate
=
click_zero_count
/
impression_zero_count
return
[
"
android
"
,
click_zero_count
,
impression_zero_count
,
round
(
android_click_zero_rate
,
4
)]
return
[
"
安卓
"
,
click_zero_count
,
impression_zero_count
,
round
(
android_click_zero_rate
,
4
)]
...
...
eda/recommended_indexs/code/getRate.py
View file @
634de7a7
...
...
@@ -15,7 +15,7 @@ def get_yesterday_date():
def
result2file
(
fpath
):
with
open
(
fpath
,
'w'
)
as
f
:
tplt
=
"{0:
<6}
\t
{1:^10}
\t
{2:^10}
\t
{3:^10
}
\n
"
tplt
=
"{0:
\u3000
<6}
\t
{1:
\u3000
<15}
\t
{2:
\u3000
<15}
\t
{3:
\u3000
<15
}
\n
"
f
.
write
(
"#注意:以下数据都是首页的
\n
"
)
f
.
write
(
"#1. 比例特征
\n
"
)
f
.
write
(
"=================================================================
\n
"
)
...
...
@@ -28,10 +28,11 @@ def result2file(fpath):
for
i
in
lst
:
line
=
tplt
.
format
(
i
[
0
],
i
[
1
],
i
[
2
],
i
[
3
])
f
.
write
(
line
)
f
.
write
(
'
\n
'
)
print
(
"1.1已将answer曝光占比存入文件"
)
f
.
write
(
"#1.2活跃用户点击率(=活跃用户点击次数/活跃用户曝光次数)
\n
"
)
f
.
write
(
tplt
.
format
(
"平台"
,
"
活跃用户点击次数"
,
"活跃用户曝光次数"
,
"活跃
用户点击率"
))
f
.
write
(
tplt
.
format
(
"平台"
,
"
active用户点击次数"
,
"active用户曝光次数"
,
"active
用户点击率"
))
all_click_one_rate
=
get_all_click_one_rate
()
ios_click_one_rate
=
get_ios_click_one_rate
()
android_click_one_rate
=
get_android_click_one_rate
()
...
...
@@ -39,6 +40,7 @@ def result2file(fpath):
for
i
in
lst
:
line
=
tplt
.
format
(
i
[
0
],
i
[
1
],
i
[
2
],
i
[
3
])
f
.
write
(
line
)
f
.
write
(
'
\n
'
)
print
(
"1.2已将活跃用户点击率存入文件"
)
f
.
write
(
"#1.3点击answer用户占比(=点击answer用户数/曝光answer用户数)
\n
"
)
...
...
@@ -50,6 +52,7 @@ def result2file(fpath):
for
i
in
lst
:
line
=
tplt
.
format
(
i
[
0
],
i
[
1
],
i
[
2
],
i
[
3
])
f
.
write
(
line
)
f
.
write
(
'
\n
'
)
print
(
"1.3已将点击answer用户占比存入文件"
)
f
.
write
(
"#1.4点击diary用户占比(=点击diary用户数/曝光diary用户数)
\n
"
)
...
...
@@ -61,10 +64,11 @@ def result2file(fpath):
for
i
in
lst
:
line
=
tplt
.
format
(
i
[
0
],
i
[
1
],
i
[
2
],
i
[
3
])
f
.
write
(
line
)
f
.
write
(
'
\n
'
)
print
(
"1.4已将点击diary用户占比存入文件"
)
f
.
write
(
"#1.5无点击用户占比(=无点击用户数/有曝光用户数)
\n
"
)
f
.
write
(
tplt
.
format
(
"平台"
,
"
无点击用户数"
,
"有曝光用户数"
,
"无
点击用户占比"
))
f
.
write
(
tplt
.
format
(
"平台"
,
"
no点击用户数"
,
"have曝光用户数"
,
"no
点击用户占比"
))
all_click_zero_rate
=
get_all_click_zero_rate
()
ios_click_zero_rate
=
get_ios_click_zero_rate
()
android_click_zero_rate
=
get_android_click_zero_rate
()
...
...
@@ -72,6 +76,7 @@ def result2file(fpath):
for
i
in
lst
:
line
=
tplt
.
format
(
i
[
0
],
i
[
1
],
i
[
2
],
i
[
3
])
f
.
write
(
line
)
f
.
write
(
'
\n
'
)
print
(
"1.5已将无点击用户占比存入文件"
)
...
...
eda/recommended_indexs/code/getTop100Answer.py
View file @
634de7a7
...
...
@@ -20,16 +20,16 @@ def tuple2dict(tuple_result):
def
result2file
(
result_lst
,
fpath
):
with
open
(
fpath
,
'w'
)
as
f
:
tplt
=
"{0:
<6}
\t
{1:<10}
\t
{2:^10}
\t
{3:^10}
\t
{4:^10}
\t
{5:<10
}
\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
(
"Top 100 Answer
\n
"
)
f
.
write
(
"=================================================================
\n
"
)
f
.
write
(
tplt
.
format
(
"平台"
,
"answer_id"
,
"
answer被点击数"
,
"answer被曝光数"
,
"answer被
点击率"
,
"answer链接"
))
f
.
write
(
tplt
.
format
(
"平台"
,
"answer_id"
,
"
点击数"
,
"曝光数"
,
"
点击率"
,
"answer链接"
))
for
i
in
result_lst
:
for
j
in
i
:
f
.
write
(
tplt
.
format
(
j
[
0
],
j
[
1
],
j
[
2
],
j
[
3
],
j
[
4
],
j
[
5
]))
f
.
write
(
"=================================================================
\n
"
)
if
i
!=
result_lst
[
-
1
]:
f
.
write
(
tplt
.
format
(
"平台"
,
"answer_id"
,
"
answer被点击数"
,
"answer被曝光数"
,
"answer被
点击率"
,
"answer链接"
))
f
.
write
(
tplt
.
format
(
"平台"
,
"answer_id"
,
"
点击数"
,
"曝光数"
,
"
点击率"
,
"answer链接"
))
f
.
write
(
"
\n\n
"
)
...
...
@@ -54,7 +54,7 @@ def get_all_top100_answer_rate_by_ctr(all_answer_count_by_click,all_answer_count
for
i
in
all_answer_count_by_click
:
if
i
in
all_answer_count_by_imp
.
keys
()
and
all_answer_count_by_click
[
i
]
>
2
:
url
=
"http://m.igengmei.com/answer/"
+
i
[
i
.
index
(
'|'
)
+
1
:]
+
'/'
all_top100_answer_rate_by_ctr
.
append
((
"
all
"
,
i
,
all_answer_count_by_click
[
i
],
all_answer_count_by_imp
[
i
],
round
(
all_answer_count_by_click
[
i
]
/
all_answer_count_by_imp
[
i
],
4
),
url
))
all_top100_answer_rate_by_ctr
.
append
((
"
所有
"
,
i
,
all_answer_count_by_click
[
i
],
all_answer_count_by_imp
[
i
],
round
(
all_answer_count_by_click
[
i
]
/
all_answer_count_by_imp
[
i
],
4
),
url
))
all_top100_answer_rate_by_ctr
.
sort
(
key
=
lambda
x
:
x
[
4
],
reverse
=
True
)
return
all_top100_answer_rate_by_ctr
[:
100
]
if
len
(
all_top100_answer_rate_by_ctr
)
>
100
else
all_top100_answer_rate_by_ctr
...
...
@@ -78,7 +78,7 @@ def get_ios_top100_answer_rate_by_ctr(ios_answer_count_by_click,ios_answer_count
for
i
in
ios_answer_count_by_click
:
if
i
in
ios_answer_count_by_imp
.
keys
()
and
ios_answer_count_by_click
[
i
]
>
2
:
url
=
"http://m.igengmei.com/answer/"
+
i
[
i
.
index
(
'|'
)
+
1
:]
+
'/'
ios_top100_answer_rate_by_ctr
.
append
((
"
ios
"
,
i
,
ios_answer_count_by_click
[
i
],
ios_answer_count_by_imp
[
i
],
round
(
ios_answer_count_by_click
[
i
]
/
ios_answer_count_by_imp
[
i
],
4
),
url
))
ios_top100_answer_rate_by_ctr
.
append
((
"
苹果
"
,
i
,
ios_answer_count_by_click
[
i
],
ios_answer_count_by_imp
[
i
],
round
(
ios_answer_count_by_click
[
i
]
/
ios_answer_count_by_imp
[
i
],
4
),
url
))
ios_top100_answer_rate_by_ctr
.
sort
(
key
=
lambda
x
:
x
[
4
],
reverse
=
True
)
return
ios_top100_answer_rate_by_ctr
[:
100
]
if
len
(
ios_top100_answer_rate_by_ctr
)
>
100
else
ios_top100_answer_rate_by_ctr
...
...
@@ -102,7 +102,7 @@ def get_android_top100_answer_rate_by_ctr(android_answer_count_by_click,android_
for
i
in
android_answer_count_by_click
:
if
i
in
android_answer_count_by_imp
.
keys
()
and
android_answer_count_by_click
[
i
]
>
2
:
url
=
"http://m.igengmei.com/answer/"
+
i
[
i
.
index
(
'|'
)
+
1
:]
+
'/'
android_top100_answer_rate_by_ctr
.
append
((
"
android
"
,
i
,
android_answer_count_by_click
[
i
],
android_answer_count_by_imp
[
i
],
round
(
android_answer_count_by_click
[
i
]
/
android_answer_count_by_imp
[
i
],
4
),
url
))
android_top100_answer_rate_by_ctr
.
append
((
"
安卓
"
,
i
,
android_answer_count_by_click
[
i
],
android_answer_count_by_imp
[
i
],
round
(
android_answer_count_by_click
[
i
]
/
android_answer_count_by_imp
[
i
],
4
),
url
))
android_top100_answer_rate_by_ctr
.
sort
(
key
=
lambda
x
:
x
[
4
],
reverse
=
True
)
return
android_top100_answer_rate_by_ctr
[:
100
]
if
len
(
android_top100_answer_rate_by_ctr
)
>
100
else
android_top100_answer_rate_by_ctr
...
...
eda/recommended_indexs/code/getTop100Diary.py
View file @
634de7a7
...
...
@@ -20,16 +20,17 @@ def tuple2dict(tuple_result):
def
result2file
(
result_lst
,
fpath
):
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:<6}
\t
{1:<10}
\t
{2:^10}
\t
{3:^10}
\t
{4:^10}
\t
{5:<10}
\n
"
f
.
write
(
"Top 100 diary
\n
"
)
f
.
write
(
"=================================================================
\n
"
)
f
.
write
(
tplt
.
format
(
"平台"
,
"diary_id"
,
"
diary被点击数"
,
"diary被曝光数"
,
"diary被
点击率"
,
"diary链接"
))
f
.
write
(
tplt
.
format
(
"平台"
,
"diary_id"
,
"
点击数"
,
"曝光数"
,
"
点击率"
,
"diary链接"
))
for
i
in
result_lst
:
for
j
in
i
:
f
.
write
(
tplt
.
format
(
j
[
0
],
j
[
1
],
j
[
2
],
j
[
3
],
j
[
4
],
j
[
5
]))
f
.
write
(
"=================================================================
\n
"
)
if
i
!=
result_lst
[
-
1
]:
f
.
write
(
tplt
.
format
(
"平台"
,
"diary_id"
,
"
diary被点击数"
,
"diary被曝光数"
,
"diary被
点击率"
,
"diary链接"
))
f
.
write
(
tplt
.
format
(
"平台"
,
"diary_id"
,
"
点击数"
,
"曝光数"
,
"
点击率"
,
"diary链接"
))
f
.
write
(
"
\n\n
"
)
...
...
@@ -53,7 +54,7 @@ def get_all_top100_diary_rate_by_ctr(all_diary_count_by_click,all_diary_count_by
for
i
in
all_diary_count_by_click
:
if
i
in
all_diary_count_by_imp
.
keys
()
and
all_diary_count_by_click
[
i
]
>
4
:
url
=
"http://m.igengmei.com/diary_book/"
+
i
[
i
.
index
(
'|'
)
+
1
:]
+
'/'
all_top100_diary_rate_by_ctr
.
append
((
"
all
"
,
i
,
all_diary_count_by_click
[
i
],
all_diary_count_by_imp
[
i
],
round
(
all_diary_count_by_click
[
i
]
/
all_diary_count_by_imp
[
i
],
4
),
url
))
all_top100_diary_rate_by_ctr
.
append
((
"
所有
"
,
i
,
all_diary_count_by_click
[
i
],
all_diary_count_by_imp
[
i
],
round
(
all_diary_count_by_click
[
i
]
/
all_diary_count_by_imp
[
i
],
4
),
url
))
all_top100_diary_rate_by_ctr
.
sort
(
key
=
lambda
x
:
x
[
4
],
reverse
=
True
)
return
all_top100_diary_rate_by_ctr
[:
100
]
if
len
(
all_top100_diary_rate_by_ctr
)
>
100
else
all_top100_diary_rate_by_ctr
...
...
@@ -77,7 +78,7 @@ def get_ios_top100_diary_rate_by_ctr(ios_top100_diary_count_by_click,ios_top100_
for
i
in
ios_diary_count_by_click
:
if
i
in
ios_diary_count_by_imp
.
keys
()
and
ios_diary_count_by_click
[
i
]
>
4
:
url
=
"http://m.igengmei.com/diary_book/"
+
i
[
i
.
index
(
'|'
)
+
1
:]
+
'/'
ios_top100_diary_rate_by_ctr
.
append
((
"
ios
"
,
i
,
ios_diary_count_by_click
[
i
],
ios_diary_count_by_imp
[
i
],
round
(
ios_diary_count_by_click
[
i
]
/
ios_diary_count_by_imp
[
i
],
4
),
url
))
ios_top100_diary_rate_by_ctr
.
append
((
"
苹果
"
,
i
,
ios_diary_count_by_click
[
i
],
ios_diary_count_by_imp
[
i
],
round
(
ios_diary_count_by_click
[
i
]
/
ios_diary_count_by_imp
[
i
],
4
),
url
))
ios_top100_diary_rate_by_ctr
.
sort
(
key
=
lambda
x
:
x
[
4
],
reverse
=
True
)
return
ios_top100_diary_rate_by_ctr
[:
100
]
if
len
(
ios_top100_diary_rate_by_ctr
)
>
100
else
ios_top100_diary_rate_by_ctr
...
...
@@ -101,7 +102,7 @@ def get_android_top100_diary_rate_by_ctr(android_top100_diary_count_by_click,and
for
i
in
android_diary_count_by_click
:
if
i
in
android_diary_count_by_imp
.
keys
()
and
android_diary_count_by_click
[
i
]
>
4
:
url
=
"http://m.igengmei.com/diary_book/"
+
i
[
i
.
index
(
'|'
)
+
1
:]
+
'/'
android_top100_diary_rate_by_ctr
.
append
((
"
android
"
,
i
,
android_diary_count_by_click
[
i
],
android_diary_count_by_imp
[
i
],
round
(
android_diary_count_by_click
[
i
]
/
android_diary_count_by_imp
[
i
],
4
),
url
))
android_top100_diary_rate_by_ctr
.
append
((
"
安卓
"
,
i
,
android_diary_count_by_click
[
i
],
android_diary_count_by_imp
[
i
],
round
(
android_diary_count_by_click
[
i
]
/
android_diary_count_by_imp
[
i
],
4
),
url
))
android_top100_diary_rate_by_ctr
.
sort
(
key
=
lambda
x
:
x
[
4
],
reverse
=
True
)
return
android_top100_diary_rate_by_ctr
[:
100
]
if
len
(
android_top100_diary_rate_by_ctr
)
>
100
else
android_top100_diary_rate_by_ctr
...
...
eda/recommended_indexs/code/getTop100Question.py
View file @
634de7a7
...
...
@@ -20,16 +20,16 @@ def tuple2dict(tuple_result):
def
result2file
(
result_lst
,
fpath
):
with
open
(
fpath
,
'w'
)
as
f
:
tplt
=
"{0:
<6}
\t
{1:<10}
\t
{2:^10}
\t
{3:^10}
\t
{4:^10}
\t
{5:<10
}
\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
(
"Top 100 Question
\n
"
)
f
.
write
(
"=================================================================
\n
"
)
f
.
write
(
tplt
.
format
(
"平台"
,
"question_id"
,
"
question被点击数"
,
"question被曝光数"
,
"question被
点击率"
,
"question链接"
))
f
.
write
(
tplt
.
format
(
"平台"
,
"question_id"
,
"
点击数"
,
"曝光数"
,
"
点击率"
,
"question链接"
))
for
i
in
result_lst
:
for
j
in
i
:
f
.
write
(
tplt
.
format
(
j
[
0
],
j
[
1
],
j
[
2
],
j
[
3
],
j
[
4
],
j
[
5
]))
f
.
write
(
"=================================================================
\n
"
)
if
i
!=
result_lst
[
-
1
]:
f
.
write
(
tplt
.
format
(
"平台"
,
"question_id"
,
"
question被点击数"
,
"question被曝光数"
,
"question被
点击率"
,
"question链接"
))
f
.
write
(
tplt
.
format
(
"平台"
,
"question_id"
,
"
点击数"
,
"曝光数"
,
"
点击率"
,
"question链接"
))
f
.
write
(
"
\n\n
"
)
...
...
@@ -54,14 +54,14 @@ def get_all_top100_question_rate_by_ctr(all_question_count_by_click,all_question
if
all_question_count_by_imp
==
{}:
for
i
in
all_question_count_by_click
:
url
=
"http://m.igengmei.com/question/"
+
i
[
i
.
index
(
'|'
)
+
1
:]
+
'/'
all_top100_question_rate_by_ctr
.
append
((
"
all
"
,
i
,
all_question_count_by_click
[
i
],
0
,
0
,
url
))
all_top100_question_rate_by_ctr
.
append
((
"
所有
"
,
i
,
all_question_count_by_click
[
i
],
0
,
0
,
url
))
all_top100_question_rate_by_ctr
.
sort
(
key
=
lambda
x
:
x
[
2
],
reverse
=
True
)
return
all_top100_question_rate_by_ctr
[:
100
]
if
len
(
all_top100_question_rate_by_ctr
)
>
100
else
all_top100_question_rate_by_ctr
else
:
for
i
in
all_question_count_by_click
:
if
i
in
all_question_count_by_imp
.
keys
()
and
all_question_count_by_click
[
i
]
>
2
:
url
=
"http://m.igengmei.com/question/"
+
i
[
i
.
index
(
'|'
)
+
1
:]
+
'/'
all_top100_question_rate_by_ctr
.
append
((
"
all
"
,
i
,
all_question_count_by_click
[
i
],
all_question_count_by_imp
[
i
],
round
(
all_question_count_by_click
[
i
]
/
all_question_count_by_imp
[
i
],
4
),
url
))
all_top100_question_rate_by_ctr
.
append
((
"
所有
"
,
i
,
all_question_count_by_click
[
i
],
all_question_count_by_imp
[
i
],
round
(
all_question_count_by_click
[
i
]
/
all_question_count_by_imp
[
i
],
4
),
url
))
all_top100_question_rate_by_ctr
.
sort
(
key
=
lambda
x
:
x
[
4
],
reverse
=
True
)
return
all_top100_question_rate_by_ctr
[:
100
]
if
len
(
all_top100_question_rate_by_ctr
)
>
100
else
all_top100_question_rate_by_ctr
...
...
@@ -85,14 +85,14 @@ def get_ios_top100_question_rate_by_ctr(ios_question_count_by_click,ios_question
if
ios_question_count_by_imp
==
{}:
for
i
in
ios_question_count_by_click
:
url
=
"http://m.igengmei.com/question/"
+
i
[
i
.
index
(
'|'
)
+
1
:]
+
'/'
ios_top100_question_rate_by_ctr
.
append
((
"
ios
"
,
i
,
ios_question_count_by_click
[
i
],
0
,
0
,
url
))
ios_top100_question_rate_by_ctr
.
append
((
"
苹果
"
,
i
,
ios_question_count_by_click
[
i
],
0
,
0
,
url
))
ios_top100_question_rate_by_ctr
.
sort
(
key
=
lambda
x
:
x
[
2
],
reverse
=
True
)
return
ios_top100_question_rate_by_ctr
[:
100
]
if
len
(
ios_top100_question_rate_by_ctr
)
>
100
else
ios_top100_question_rate_by_ctr
else
:
for
i
in
ios_question_count_by_click
:
if
i
in
ios_question_count_by_imp
.
keys
()
and
ios_question_count_by_click
[
i
]
>
2
:
url
=
"http://m.igengmei.com/question/"
+
i
[
i
.
index
(
'|'
)
+
1
:]
+
'/'
ios_top100_question_rate_by_ctr
.
append
((
"
ios
"
,
i
,
ios_question_count_by_click
[
i
],
ios_question_count_by_imp
[
i
],
round
(
ios_question_count_by_click
[
i
]
/
ios_question_count_by_imp
[
i
],
4
),
url
))
ios_top100_question_rate_by_ctr
.
append
((
"
苹果
"
,
i
,
ios_question_count_by_click
[
i
],
ios_question_count_by_imp
[
i
],
round
(
ios_question_count_by_click
[
i
]
/
ios_question_count_by_imp
[
i
],
4
),
url
))
ios_top100_question_rate_by_ctr
.
sort
(
key
=
lambda
x
:
x
[
4
],
reverse
=
True
)
return
ios_top100_question_rate_by_ctr
[:
100
]
if
len
(
ios_top100_question_rate_by_ctr
)
>
100
else
ios_top100_question_rate_by_ctr
...
...
@@ -116,14 +116,14 @@ def get_android_top100_question_rate_by_ctr(android_question_count_by_click,andr
if
android_question_count_by_imp
==
{}:
for
i
in
android_question_count_by_click
:
url
=
"http://m.igengmei.com/question/"
+
i
[
i
.
index
(
'|'
)
+
1
:]
+
'/'
android_top100_question_rate_by_ctr
.
append
((
"
android
"
,
i
,
android_question_count_by_click
[
i
],
0
,
0
,
url
))
android_top100_question_rate_by_ctr
.
append
((
"
安卓
"
,
i
,
android_question_count_by_click
[
i
],
0
,
0
,
url
))
android_top100_question_rate_by_ctr
.
sort
(
key
=
lambda
x
:
x
[
2
],
reverse
=
True
)
return
android_top100_question_rate_by_ctr
[:
100
]
if
len
(
android_top100_question_rate_by_ctr
)
>
100
else
android_top100_question_rate_by_ctr
else
:
for
i
in
android_question_count_by_click
:
if
i
in
android_question_count_by_imp
.
keys
()
and
android_question_count_by_click
[
i
]
>
2
:
url
=
"http://m.igengmei.com/question/"
+
i
[
i
.
index
(
'|'
)
+
1
:]
+
'/'
android_top100_question_rate_by_ctr
.
append
((
"
android
"
,
i
,
android_question_count_by_click
[
i
],
android_question_count_by_imp
[
i
],
round
(
android_question_count_by_click
[
i
]
/
android_question_count_by_imp
[
i
],
4
),
url
))
android_top100_question_rate_by_ctr
.
append
((
"
安卓
"
,
i
,
android_question_count_by_click
[
i
],
android_question_count_by_imp
[
i
],
round
(
android_question_count_by_click
[
i
]
/
android_question_count_by_imp
[
i
],
4
),
url
))
android_top100_question_rate_by_ctr
.
sort
(
key
=
lambda
x
:
x
[
4
],
reverse
=
True
)
return
android_top100_question_rate_by_ctr
[:
100
]
if
len
(
android_top100_question_rate_by_ctr
)
>
100
else
android_top100_question_rate_by_ctr
...
...
eda/recommended_indexs/code/start.sh
View file @
634de7a7
...
...
@@ -4,4 +4,4 @@ python getTop100Diary.py
python getTop100Answer.py
python getTop100Question.py
dt
=
$(
date
-d
last-day +%Y%m%d
)
cat
1rate_features_
$dt
.txt 2click_times_to_count_uid_
$dt
.txt 3top100_ctr_diary_
$dt
.txt 4top100_ctr_answer_
$dt
.txt 5top100_ctr_question_
$dt
.txt
>
result_all_
$dt
.txt
\ No newline at end of file
cat
/data2/models/eda/recommended_indexs/1rate_features_
$dt
.txt /data2/models/eda/recommended_indexs/2click_times_to_count_uid_
$dt
.txt /data2/models/eda/recommended_indexs/3top100_ctr_diary_
$dt
.txt /data2/models/eda/recommended_indexs/4top100_ctr_answer_
$dt
.txt /data2/models/eda/recommended_indexs/5top100_ctr_question_
$dt
.txt
>
/data2/models/eda/recommended_indexs/result_all_
$dt
.txt
\ No newline at end of file
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