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
4fd9eed9
Commit
4fd9eed9
authored
Oct 15, 2018
by
高雅喆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add log and rm black device_id
parent
3331d70b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
6 deletions
+25
-6
node2vec_ctr.py
eda/gray_stat/node2vec_ctr.py
+25
-6
No files found.
eda/gray_stat/node2vec_ctr.py
View file @
4fd9eed9
...
@@ -24,7 +24,10 @@ class GrayStat(object):
...
@@ -24,7 +24,10 @@ class GrayStat(object):
and device_id in
\
and device_id in
\
(select device_id
\
(select device_id
\
from nd_device_cid_similarity_matrix_tmp
\
from nd_device_cid_similarity_matrix_tmp
\
where stat_date='{0}')"
.
format
(
self
.
ndays
,
self
.
cid_type
,
self
.
uid_type
)
where stat_date='{0}')
\
and device_id not in (select distinct(device_id) from jerry_test.bl_device_list)
\
and device_id not in (select distinct(device_id) from jerry_prod.blacklist)"
.
format
(
self
.
ndays
,
\
self
.
cid_type
,
self
.
uid_type
)
uid_count
=
con_sql
(
sql
)[
0
][
0
]
uid_count
=
con_sql
(
sql
)[
0
][
0
]
return
uid_count
return
uid_count
...
@@ -36,7 +39,10 @@ class GrayStat(object):
...
@@ -36,7 +39,10 @@ class GrayStat(object):
and device_id in
\
and device_id in
\
(select device_id
\
(select device_id
\
from nd_device_cid_similarity_matrix_tmp
\
from nd_device_cid_similarity_matrix_tmp
\
where stat_date='{0}')"
.
format
(
self
.
ndays
,
self
.
cid_type
,
self
.
uid_type
)
where stat_date='{0}')
\
and device_id not in (select distinct(device_id) from jerry_test.bl_device_list)
\
and device_id not in (select distinct(device_id) from jerry_prod.blacklist)"
.
format
(
self
.
ndays
,
\
self
.
cid_type
,
self
.
uid_type
)
uid_clk_times
=
con_sql
(
sql
)[
0
][
0
]
uid_clk_times
=
con_sql
(
sql
)[
0
][
0
]
return
uid_clk_times
return
uid_clk_times
...
@@ -48,7 +54,10 @@ class GrayStat(object):
...
@@ -48,7 +54,10 @@ class GrayStat(object):
and device_id in
\
and device_id in
\
(select device_id
\
(select device_id
\
from nd_device_cid_similarity_matrix_tmp
\
from nd_device_cid_similarity_matrix_tmp
\
where stat_date='{0}')"
.
format
(
self
.
ndays
,
self
.
cid_type
,
self
.
uid_type
)
where stat_date='{0}')
\
and device_id not in (select distinct(device_id) from jerry_test.bl_device_list)
\
and device_id not in (select distinct(device_id) from jerry_prod.blacklist)"
.
format
(
self
.
ndays
,
\
self
.
cid_type
,
self
.
uid_type
)
uid_imp_times
=
con_sql
(
sql
)[
0
][
0
]
uid_imp_times
=
con_sql
(
sql
)[
0
][
0
]
return
uid_imp_times
return
uid_imp_times
...
@@ -69,7 +78,10 @@ class AllStat(object):
...
@@ -69,7 +78,10 @@ class AllStat(object):
sql
=
"select count(distinct(device_id)) from data_feed_click
\
sql
=
"select count(distinct(device_id)) from data_feed_click
\
where stat_date='{0}'
\
where stat_date='{0}'
\
and (cid_type='{1}' or cid_type='diary_video')
\
and (cid_type='{1}' or cid_type='diary_video')
\
and device_id regexp '[{2}]$'"
.
format
(
self
.
ndays
,
self
.
cid_type
,
self
.
uid_type
)
and device_id regexp '[{2}]$'
\
and device_id not in (select distinct(device_id) from jerry_test.bl_device_list)
\
and device_id not in (select distinct(device_id) from jerry_prod.blacklist)"
.
format
(
self
.
ndays
,
\
self
.
cid_type
,
self
.
uid_type
)
uid_count
=
con_sql
(
sql
)[
0
][
0
]
uid_count
=
con_sql
(
sql
)[
0
][
0
]
return
uid_count
return
uid_count
...
@@ -77,7 +89,10 @@ class AllStat(object):
...
@@ -77,7 +89,10 @@ class AllStat(object):
sql
=
"select count(device_id) from data_feed_click
\
sql
=
"select count(device_id) from data_feed_click
\
where stat_date='{0}'
\
where stat_date='{0}'
\
and (cid_type='{1}' or cid_type='diary_video')
\
and (cid_type='{1}' or cid_type='diary_video')
\
and device_id regexp '[{2}]$'"
.
format
(
self
.
ndays
,
self
.
cid_type
,
self
.
uid_type
)
and device_id regexp '[{2}]$'
\
and device_id not in (select distinct(device_id) from jerry_test.bl_device_list)
\
and device_id not in (select distinct(device_id) from jerry_prod.blacklist)"
.
format
(
self
.
ndays
,
\
self
.
cid_type
,
self
.
uid_type
)
uid_clk_times
=
con_sql
(
sql
)[
0
][
0
]
uid_clk_times
=
con_sql
(
sql
)[
0
][
0
]
return
uid_clk_times
return
uid_clk_times
...
@@ -85,7 +100,10 @@ class AllStat(object):
...
@@ -85,7 +100,10 @@ class AllStat(object):
sql
=
"select count(device_id) from data_feed_exposure
\
sql
=
"select count(device_id) from data_feed_exposure
\
where stat_date='{0}'
\
where stat_date='{0}'
\
and cid_type='{1}'
\
and cid_type='{1}'
\
and device_id regexp '[{2}]$'"
.
format
(
self
.
ndays
,
self
.
cid_type
,
self
.
uid_type
)
and device_id regexp '[{2}]$'
\
and device_id not in (select distinct(device_id) from jerry_test.bl_device_list)
\
and device_id not in (select distinct(device_id) from jerry_prod.blacklist)"
.
format
(
self
.
ndays
,
\
self
.
cid_type
,
self
.
uid_type
)
uid_imp_times
=
con_sql
(
sql
)[
0
][
0
]
uid_imp_times
=
con_sql
(
sql
)[
0
][
0
]
return
uid_imp_times
return
uid_imp_times
...
@@ -95,6 +113,7 @@ def main():
...
@@ -95,6 +113,7 @@ def main():
output
=
OUTPUT_PATH
+
"ctr.csv"
output
=
OUTPUT_PATH
+
"ctr.csv"
result
=
[]
result
=
[]
for
my_date
in
date_list
:
for
my_date
in
date_list
:
print
(
"stat"
+
" "
+
my_date
)
g_class
=
GrayStat
(
"diary"
,
"3|4"
,
my_date
)
g_class
=
GrayStat
(
"diary"
,
"3|4"
,
my_date
)
a_class
=
AllStat
(
"diary"
,
"3|4"
,
my_date
)
a_class
=
AllStat
(
"diary"
,
"3|4"
,
my_date
)
line1
=
str
(
g_class
.
get_uid_count
())
+
"
\t
"
+
str
(
g_class
.
get_uid_imp_times
())
+
"
\t
"
+
str
(
g_class
.
get_uid_clk_times
())
line1
=
str
(
g_class
.
get_uid_count
())
+
"
\t
"
+
str
(
g_class
.
get_uid_imp_times
())
+
"
\t
"
+
str
(
g_class
.
get_uid_clk_times
())
...
...
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