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
876508a0
Commit
876508a0
authored
Aug 28, 2018
by
高雅喆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change get_yesterday_format
parent
aa2c9ea1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
+7
-7
main.py
eda/recommended_indexs/main.py
+3
-3
topFeatures.py
eda/recommended_indexs/topFeatures.py
+2
-2
utils.py
eda/recommended_indexs/utils.py
+2
-2
No files found.
eda/recommended_indexs/main.py
View file @
876508a0
...
...
@@ -116,7 +116,7 @@ print("done")
def
result2file
():
output_path
=
DIRECTORY_PATH
+
"result_{}.txt"
.
format
(
get_yesterday_date
())
output_path
=
DIRECTORY_PATH
+
"result_{}.txt"
.
format
(
get_yesterday_date
()
.
replace
(
'-'
,
''
)
)
with
open
(
output_path
,
'w'
)
as
f
:
tplt
=
"{0:
\u3000
<6}
\t
{1:
\u3000
<15}
\t
{2:
\u3000
<15}
\t
{3:
\u3000
<15}
\n
"
line
=
"""数据日期:{}
...
...
@@ -141,7 +141,7 @@ def result2file():
具体内容:以下所有数据都是昨天一天的首页的
"""
.
format
(
get_yesterday_date
())
"""
.
format
(
get_yesterday_date
()
.
replace
(
'-'
,
''
)
)
f
.
write
(
line
)
f
.
write
(
"#1. 比例特征
\n
"
)
f
.
write
(
"=================================================================
\n
"
)
...
...
@@ -265,7 +265,7 @@ def result2file():
def
rate2file
():
output_path
=
DIRECTORY_PATH
+
"rate.csv"
with
open
(
output_path
,
'a+'
)
as
f
:
line
=
get_yesterday_date
()
+
','
+
\
line
=
get_yesterday_date
()
.
replace
(
'-'
,
''
)
+
','
+
\
str
(
answer_imp_rate_all
[
3
])
+
','
+
str
(
answer_imp_rate_ios
[
3
])
+
','
+
str
(
answer_imp_rate_android
[
3
])
+
','
+
\
str
(
diary_imp_rate_all
[
3
])
+
','
+
str
(
diary_imp_rate_ios
[
3
])
+
','
+
str
(
diary_imp_rate_android
[
3
])
+
','
+
\
str
(
activate_uid_ctr_all
[
3
])
+
','
+
str
(
activate_uid_ctr_ios
[
3
])
+
','
+
str
(
activate_uid_ctr_android
[
3
])
+
','
+
\
...
...
eda/recommended_indexs/topFeatures.py
View file @
876508a0
...
...
@@ -124,7 +124,7 @@ def main():
clk_diary_ctr_android
=
top_diary_android
.
get_result
(
"安卓"
,
4
,
"ctr"
)
result_lst
=
[
clk_diary_ctr_all
,
clk_diary_ctr_ios
,
clk_diary_ctr_android
]
output_path
=
DIRECTORY_PATH
+
"top100_ctr_diary_{}.txt"
.
format
(
get_yesterday_date
())
output_path
=
DIRECTORY_PATH
+
"top100_ctr_diary_{}.txt"
.
format
(
get_yesterday_date
()
.
replace
(
'-'
,
''
)
)
top_diary_all
.
result2file
(
result_lst
,
output_path
)
print
(
"已获取 Top diary 特征"
)
...
...
@@ -139,7 +139,7 @@ def main():
clk_answer_ctr_android
=
top_answer_android
.
get_result
(
"安卓"
,
2
,
"ctr"
)
result_lst
=
[
clk_answer_ctr_all
,
clk_answer_ctr_ios
,
clk_answer_ctr_android
]
output_path
=
DIRECTORY_PATH
+
"top100_ctr_answer_{}.txt"
.
format
(
get_yesterday_date
())
output_path
=
DIRECTORY_PATH
+
"top100_ctr_answer_{}.txt"
.
format
(
get_yesterday_date
()
.
replace
(
'-'
,
''
)
)
top_answer_all
.
result2file
(
result_lst
,
output_path
)
print
(
"已获取 Top answer 特征"
)
...
...
eda/recommended_indexs/utils.py
View file @
876508a0
...
...
@@ -27,11 +27,11 @@ def tuple2dict(tuple_result):
return
dict_result
def
get_yesterday_date
():
#自动获取昨天的日期,如"2018
08
08"
#自动获取昨天的日期,如"2018
-08-
08"
"""
:rtype : str
"""
today
=
datetime
.
date
.
today
()
yesterday
=
today
-
datetime
.
timedelta
(
days
=
1
)
yesterday
=
yesterday
.
strftime
(
"
%
Y
%
m
%
d"
)
yesterday
=
yesterday
.
strftime
(
"
%
Y
-
%
m-
%
d"
)
return
yesterday
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