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
b09b7f2d
Commit
b09b7f2d
authored
Sep 05, 2018
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改模型训练和ctr文件中点击表和曝光表的名称
parent
a803f9aa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
8 deletions
+7
-8
ctr.py
ctr.py
+4
-4
prepareData.py
prepareData.py
+3
-4
No files found.
ctr.py
View file @
b09b7f2d
...
...
@@ -5,7 +5,7 @@ from datetime import timedelta
def
get_tail8
():
sql
=
"select distinct device_id from data_feed_click
2
\
sql
=
"select distinct device_id from data_feed_click
\
where stat_date='{}'
\
and cid_type='{}'
\
and device_id regexp '8$';"
.
format
(
stat_date
,
cid_type
)
...
...
@@ -24,7 +24,7 @@ def get_tail8():
def
get_ctr
(
user_tuple
):
sql
=
"select count(device_id) from data_feed_click
2
\
sql
=
"select count(device_id) from data_feed_click
\
where stat_date='{}'
\
and cid_type='{}'
\
and device_id in {}"
.
format
(
stat_date
,
cid_type
,
user_tuple
)
...
...
@@ -35,7 +35,7 @@ def get_ctr(user_tuple):
click
=
cursor
.
fetchall
()[
0
][
0
]
print
(
click
)
sql
=
"select count(device_id) from data_feed_exposure
2
\
sql
=
"select count(device_id) from data_feed_exposure
\
where stat_date='{}'
\
and cid_type='{}'
\
and device_id in {}"
.
format
(
stat_date
,
cid_type
,
user_tuple
)
...
...
@@ -54,7 +54,7 @@ def get_tail6():
print
(
len
(
pre_list
))
print
(
pre_list
[:
2
])
db
=
pymysql
.
connect
(
host
=
'10.66.157.22'
,
port
=
4000
,
user
=
'root'
,
passwd
=
'3SYz54LS9#^9sBvC'
,
db
=
'jerry_test'
)
sql
=
"select distinct device_id from data_feed_click
2
\
sql
=
"select distinct device_id from data_feed_click
\
where stat_date='{}'
\
and cid_type='{}'
\
and device_id in {}"
.
format
(
stat_date
,
cid_type
,
pre_list
)
...
...
prepareData.py
View file @
b09b7f2d
...
...
@@ -4,15 +4,14 @@ import time
import
pymysql
def
fetch_data
(
start_date
,
end_date
):
# 获取点击表里的device_id
db
=
pymysql
.
connect
(
host
=
'10.66.157.22'
,
port
=
4000
,
user
=
'root'
,
passwd
=
'3SYz54LS9#^9sBvC'
,
db
=
'jerry_test'
)
sql
=
"select distinct device_id from data_feed_click
2
"
sql
=
"select distinct device_id from data_feed_click"
click_device_id
=
con_sql
(
db
,
sql
)[
0
]
.
values
.
tolist
()
print
(
"成功获取点击表里的device_id"
)
# 获取点击表里的数据
sql
=
"select cid,device_id,time,stat_date from data_feed_click
2
"
\
sql
=
"select cid,device_id,time,stat_date from data_feed_click "
\
"where stat_date >= '{0}' and stat_date <= '{1}'"
.
format
(
start_date
,
end_date
)
# 因为上面的db已经关了,需要再写一遍
db
=
pymysql
.
connect
(
host
=
'10.66.157.22'
,
port
=
4000
,
user
=
'root'
,
passwd
=
'3SYz54LS9#^9sBvC'
,
db
=
'jerry_test'
)
...
...
@@ -25,7 +24,7 @@ def fetch_data(start_date, end_date):
click
=
click
.
drop
(
"time_date"
,
axis
=
1
)
# 获取曝光表里的数据
sql
=
"select cid,device_id,time,stat_date from data_feed_exposure
2
"
\
sql
=
"select cid,device_id,time,stat_date from data_feed_exposure "
\
"where stat_date >= '{0}' and stat_date <= '{1}'"
.
format
(
start_date
,
end_date
)
start
=
time
.
time
()
# 因为上面的db已经关了,需要再写一遍
...
...
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