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
ae04a5a8
Commit
ae04a5a8
authored
Oct 15, 2018
by
高雅喆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add args
parent
0637452d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
8 deletions
+24
-8
node2vec_ctr.py
eda/gray_stat/node2vec_ctr.py
+24
-8
No files found.
eda/gray_stat/node2vec_ctr.py
View file @
ae04a5a8
# -*- coding: UTF-8 -*-
from
utils
import
con_sql
,
get_yesterday_date
,
get_between_day
import
time
import
sys
OUTPUT_PATH
=
"/data2/models/eda/node2vec/"
num
=
sys
.
argv
[
1
]
if
num
==
"3|4"
:
OUTPUT_PATH
=
"/data2/models/eda/node2vec/3|4"
table_name
=
"jerry_prod.nd_device_cid_similarity_matrix_tmp"
elif
num
==
"5|6"
:
OUTPUT_PATH
=
"/data2/models/eda/node2vec/5|6"
table_name
=
"eagle.ffm_diary_queue"
elif
num
==
"7|8"
:
OUTPUT_PATH
=
"/data2/models/eda/node2vec/7|8"
table_name
=
"eagle.search_queue"
else
:
print
(
"参数必须是 '3|4' 或 '5|6' 或 '7|8'"
)
print
(
"程序异常停止,请重新输入参数运行"
)
sys
.
exit
()
class
GrayStat
(
object
):
def
__init__
(
self
,
cid_type
,
uid_type
,
ndays
=
get_yesterday_date
()):
...
...
@@ -23,10 +39,10 @@ class GrayStat(object):
and device_id regexp '[{2}]$'
\
and device_id in
\
(select device_id
\
from
nd_device_cid_similarity_matrix_tmp
)
\
from
{3}
)
\
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
)
self
.
cid_type
,
self
.
uid_type
,
table_name
)
uid_count
=
con_sql
(
sql
)[
0
][
0
]
return
uid_count
...
...
@@ -37,10 +53,10 @@ class GrayStat(object):
and device_id regexp '[{2}]$'
\
and device_id in
\
(select device_id
\
from
nd_device_cid_similarity_matrix_tmp
)
\
from
{3}
)
\
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
)
self
.
cid_type
,
self
.
uid_type
,
table_name
)
uid_clk_times
=
con_sql
(
sql
)[
0
][
0
]
return
uid_clk_times
...
...
@@ -51,10 +67,10 @@ class GrayStat(object):
and device_id regexp '[{2}]$'
\
and device_id in
\
(select device_id
\
from
nd_device_cid_similarity_matrix_tmp
)
\
from
{3}
)
\
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
)
self
.
cid_type
,
self
.
uid_type
,
table_name
)
uid_imp_times
=
con_sql
(
sql
)[
0
][
0
]
return
uid_imp_times
...
...
@@ -109,8 +125,8 @@ def main():
output
=
OUTPUT_PATH
+
"ctr.csv"
with
open
(
output
,
"a+"
)
as
f
:
print
(
"stat"
+
" "
+
get_yesterday_date
())
g_class
=
GrayStat
(
"diary"
,
"3|4"
)
a_class
=
AllStat
(
"diary"
,
"3|4"
)
g_class
=
GrayStat
(
"diary"
,
num
)
a_class
=
AllStat
(
"diary"
,
num
)
line1
=
str
(
g_class
.
get_uid_count
())
+
"
\t
"
+
str
(
g_class
.
get_uid_imp_times
())
+
"
\t
"
+
str
(
g_class
.
get_uid_clk_times
())
line2
=
str
(
a_class
.
get_uid_count
())
+
"
\t
"
+
str
(
a_class
.
get_uid_imp_times
())
+
"
\t
"
+
str
(
a_class
.
get_uid_clk_times
())
g_ctr
=
g_class
.
get_uid_clk_times
()
/
g_class
.
get_uid_imp_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