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
aa7d043a
Commit
aa7d043a
authored
Aug 09, 2018
by
高雅喆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug in class TopFeatures of eda/test/
parent
652bfcb4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
14 deletions
+12
-14
getTopFeatures.py
eda/test/getTopFeatures.py
+12
-14
No files found.
eda/test/getTopFeatures.py
View file @
aa7d043a
...
...
@@ -36,7 +36,7 @@ class TopFeatures(object):
def
get_impression_times
(
self
):
# rtype : dict
if
self
.
cid_type
[
-
2
]
==
'e'
:
:
if
self
.
cid_type
[
-
2
]
==
'e'
:
self
.
cid_type
=
self
.
cid_type
[:
-
6
]
+
' '
+
self
.
cid_type
[:
-
6
:]
sql
=
"select cid,count(cid) from data_feed_exposure
\
where from_unixtime(time,'
%
Y-
%
m-
%
d')=date_add(curdate(), interval -{0} day)
\
...
...
@@ -45,7 +45,7 @@ class TopFeatures(object):
imp_times
=
tuple2dict
(
con_sql
(
sql
))
return
imp_times
def
get_result
(
self
,
result_types
=
"ctr"
,
clk
,
imp
,
clk_n
=
2
):
def
get_result
(
self
,
clk
,
imp
,
clk_n
=
2
,
result_types
=
"ctr"
):
"""
result_types : "clk";"imp";"ctr"
clk : dict
...
...
@@ -112,23 +112,21 @@ class TopFeatures(object):
def
main
():
top_diary
=
TopFeatures
(
1
,
"all"
,
"diary"
)
clk_diary_times_all
=
get_click_times
()
imp_diary_times_all
=
get_impression_times
()
clk_diary_ctr_all
=
get_result
(
"ctr"
,
clk_diary_times_all
,
imp_diary_times_all
,
top_n
=
100
)
clk_diary_times_all
=
top_diary
.
get_click_times
()
imp_diary_times_all
=
top_diary
.
get_impression_times
()
clk_diary_ctr_all
=
top_diary
.
get_result
(
"ctr"
,
clk_diary_times_all
,
imp_diary_times_all
,
top_n
=
100
)
top_diary
=
TopFeatures
(
1
,
"ios"
,
"diary"
)
clk_diary_times_ios
=
get_click_times
()
imp_diary_times_ios
=
get_impression_times
()
clk_diary_ctr_ios
=
get_result
(
"ctr"
,
clk_diary_times_ios
,
imp_diary_times_ios
,
top_n
=
100
)
clk_diary_times_ios
=
top_diary
.
get_click_times
()
imp_diary_times_ios
=
top_diary
.
get_impression_times
()
clk_diary_ctr_ios
=
top_diary
.
get_result
(
"ctr"
,
clk_diary_times_ios
,
imp_diary_times_ios
,
top_n
=
100
)
top_diary
=
TopFeatures
(
1
,
"android"
,
"diary"
)
clk_diary_times_android
=
get_click_times
()
imp_diary_times_android
=
get_impression_times
()
clk_diary_ctr_android
=
get_result
(
"ctr"
,
clk_diary_times_android
,
imp_diary_times_android
,
top_n
=
100
)
clk_diary_times_android
=
top_diary
.
get_click_times
()
imp_diary_times_android
=
top_diary
.
get_impression_times
()
clk_diary_ctr_android
=
top_diary
.
get_result
(
"ctr"
,
clk_diary_times_android
,
imp_diary_times_android
,
top_n
=
100
)
result_lst
=
[
clk_diary_ctr_all
,
clk_diary_ctr_ios
,
clk_diary_ctr_android
]
output_path
=
DIRECTORY_PATH
+
"5top100_ctr_diary_
%
s.txt"
result2file
(
result_lst
,
output_path
)
top_diary
.
result2file
(
result_lst
,
output_path
)
...
...
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