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
e27ee920
Commit
e27ee920
authored
Aug 22, 2018
by
张彦钊
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of git.wanmeizhensuo.com:ML/ffm-baseline
parents
09266935
4ec76001
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
22 deletions
+27
-22
func.py
eda/recommended_indexs/func.py
+1
-1
main.py
eda/recommended_indexs/main.py
+26
-21
No files found.
eda/recommended_indexs/func.py
View file @
e27ee920
...
...
@@ -61,7 +61,7 @@ def get_activate_uid_imp_times(city,ndays=1):
and from_unixtime(time,'
%
Y-
%
m-
%
d')=date_add(curdate(), interval -{0} day)
\
and city_id{1}"
.
format
(
ndays
,
city
)
sql_imp_times
=
con_sql
(
sql_imp
)[
0
][
0
]
if
city
==
"
beijing
"
:
if
city
==
"
='beijing'
"
:
city
=
"北京"
else
:
city
=
"所有"
...
...
eda/recommended_indexs/main.py
View file @
e27ee920
...
...
@@ -57,14 +57,17 @@ click_everything_result = [click_everything_all,click_everything_ios,click_every
print
(
"已获取有点击用户占比"
)
#1.8 无点击用户数分布(=无点击用户∩激活用户 / 激活用户数) #注意:(]里面的数字指的是距离当前时间的天数
click_zero_uid_detail_all
=
get_click_zero_uid_rate_detail
(
"all"
)
click_zero_uid_detail_all
[
"platform"
]
=
"所有"
click_zero_uid_detail_ios
=
get_click_zero_uid_rate_detail
(
"ios"
)
click_zero_uid_detail_ios
[
"platform"
]
=
"苹果"
click_zero_uid_detail_android
=
get_click_zero_uid_rate_detail
(
"android"
)
click_zero_uid_detail_android
[
"platform"
]
=
"安卓"
click_zero_uid_detail_result
=
[
click_zero_uid_detail_all
,
click_zero_uid_detail_ios
,
click_zero_uid_detail_android
]
print
(
"已获取无点击用户数激活日期分布"
)
try
:
click_zero_uid_detail_all
=
get_click_zero_uid_rate_detail
(
"all"
)
click_zero_uid_detail_all
[
"platform"
]
=
"所有"
click_zero_uid_detail_ios
=
get_click_zero_uid_rate_detail
(
"ios"
)
click_zero_uid_detail_ios
[
"platform"
]
=
"苹果"
click_zero_uid_detail_android
=
get_click_zero_uid_rate_detail
(
"android"
)
click_zero_uid_detail_android
[
"platform"
]
=
"安卓"
click_zero_uid_detail_result
=
[
click_zero_uid_detail_all
,
click_zero_uid_detail_ios
,
click_zero_uid_detail_android
]
print
(
"已获取无点击用户数激活日期分布"
)
except
:
print
(
"GC life time is shorter than transaction duration"
)
#==========================================================================================
...
...
@@ -111,7 +114,7 @@ def result2file():
1.5 点击answer用户占比(=点击answer用户数/曝光answer用户数)
1.6 点击diary用户占比(=点击diary用户数/曝光diary用户数)
1.7 有点击用户占比(=有点击用户数/有曝光用户数)
1.8 无点击用户数分布(=无点击用户∩激活用户 / 激活用户数) #注意:
(]里面
的数字指的是距离当前时间的天数
1.8 无点击用户数分布(=无点击用户∩激活用户 / 激活用户数) #注意:
平台一排
的数字指的是距离当前时间的天数
2.Top特征
2.1 用户点击次数分布(第一列:用户点击次数;第二列:独立用户数量)
2.2 Top 100 diary (sorted by ctr)
...
...
@@ -167,18 +170,20 @@ def result2file():
line
=
tplt
.
format
(
i
[
0
],
i
[
1
],
i
[
2
],
"{}
%
"
.
format
(
round
(
i
[
3
]
*
100
,
2
)))
f
.
write
(
line
)
f
.
write
(
'
\n
'
)
f
.
write
(
"#1.8无点击用户数分布(=无点击用户∩激活用户 / 激活用户数) #注意:(]里面的数字指的是距离当前时间的天数
\n
"
)
f
.
write
(
"平台"
+
'
\t\t
'
+
"0-7"
+
'
\t\t
'
+
"7-14"
+
'
\t\t
'
+
\
"14-30"
+
'
\t\t
'
+
"30-60"
+
'
\t\t
'
+
"60-90"
+
'
\t\t
'
+
"90+"
+
'
\n
'
)
for
i
in
click_zero_uid_detail_result
:
f
.
write
(
i
[
"platform"
]
+
'
\t\t
'
+
\
"{}
%
"
.
format
(
round
(
i
[
"0-7"
]
*
100
,
2
))
+
'
\t\t
'
+
\
"{}
%
"
.
format
(
round
(
i
[
"7-14"
]
*
100
,
2
))
+
'
\t\t
'
+
\
"{}
%
"
.
format
(
round
(
i
[
"14-30"
]
*
100
,
2
))
+
'
\t\t
'
+
\
"{}
%
"
.
format
(
round
(
i
[
"30-60"
]
*
100
,
2
))
+
'
\t\t
'
+
\
"{}
%
"
.
format
(
round
(
i
[
"60-90"
]
*
100
,
2
))
+
'
\t\t
'
+
\
"{}
%
"
.
format
(
round
(
i
[
"90+"
]
*
100
,
2
))
+
'
\n
'
)
f
.
write
(
'
\n\n\n
'
)
if
"click_zero_uid_detail_result"
in
dir
():
f
.
write
(
"#1.8无点击用户数分布(=无点击用户∩激活用户 / 激活用户数) #注意:(]里面的数字指的是距离当前时间的天数
\n
"
)
f
.
write
(
"平台"
+
'
\t\t
'
+
"0-7"
+
'
\t\t
'
+
"7-14"
+
'
\t\t
'
+
\
"14-30"
+
'
\t\t
'
+
"30-60"
+
'
\t\t
'
+
"60-90"
+
'
\t\t
'
+
"90+"
+
'
\n
'
)
for
i
in
click_zero_uid_detail_result
:
f
.
write
(
i
[
"platform"
]
+
'
\t\t
'
+
\
"{}
%
"
.
format
(
round
(
i
[
"0-7"
]
*
100
,
2
))
+
'
\t\t
'
+
\
"{}
%
"
.
format
(
round
(
i
[
"7-14"
]
*
100
,
2
))
+
'
\t\t
'
+
\
"{}
%
"
.
format
(
round
(
i
[
"14-30"
]
*
100
,
2
))
+
'
\t\t
'
+
\
"{}
%
"
.
format
(
round
(
i
[
"30-60"
]
*
100
,
2
))
+
'
\t\t
'
+
\
"{}
%
"
.
format
(
round
(
i
[
"60-90"
]
*
100
,
2
))
+
'
\t\t
'
+
\
"{}
%
"
.
format
(
round
(
i
[
"90+"
]
*
100
,
2
))
+
'
\n
'
)
f
.
write
(
'
\n\n\n
'
)
#==========================================================================================
tplt
=
"{0:^10}
\t
{1:^10}
\n
"
f
.
write
(
"#2. Top特征
\n
"
)
...
...
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