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
ce50f559
Commit
ce50f559
authored
Aug 28, 2018
by
高雅喆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug in stat_date sql
parent
9fbc4300
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
14 deletions
+14
-14
cidRate.py
eda/recommended_indexs/cidRate.py
+4
-4
clkCidUidRate.py
eda/recommended_indexs/clkCidUidRate.py
+2
-2
func.py
eda/recommended_indexs/func.py
+6
-6
topFeatures.py
eda/recommended_indexs/topFeatures.py
+2
-2
No files found.
eda/recommended_indexs/cidRate.py
View file @
ce50f559
...
@@ -23,12 +23,12 @@ class CidRate(object):
...
@@ -23,12 +23,12 @@ class CidRate(object):
rtype : list
rtype : list
"""
"""
sql_cid
=
"select count(cid) from data_feed_click2
\
sql_cid
=
"select count(cid) from data_feed_click2
\
where stat_date
>
'{0}'
\
where stat_date
=
'{0}'
\
and device_type{1}
\
and device_type{1}
\
and cid_type='{2}'"
.
format
(
get_yesterday_date
(),
self
.
platform
.
replace
(
' '
,
''
)
if
self
.
platform
[
-
2
]
==
'e'
else
self
.
platform
,
self
.
cid_type
)
and cid_type='{2}'"
.
format
(
get_yesterday_date
(),
self
.
platform
.
replace
(
' '
,
''
)
if
self
.
platform
[
-
2
]
==
'e'
else
self
.
platform
,
self
.
cid_type
)
cid_clk_count
=
con_sql
(
sql_cid
)[
0
][
0
]
cid_clk_count
=
con_sql
(
sql_cid
)[
0
][
0
]
sql_all
=
"select count(cid) from data_feed_click2
\
sql_all
=
"select count(cid) from data_feed_click2
\
where stat_date
>
'{0}'
\
where stat_date
=
'{0}'
\
and device_type{1}"
.
format
(
get_yesterday_date
(),
self
.
platform
.
replace
(
' '
,
''
)
if
self
.
platform
[
-
2
]
==
'e'
else
self
.
platform
)
and device_type{1}"
.
format
(
get_yesterday_date
(),
self
.
platform
.
replace
(
' '
,
''
)
if
self
.
platform
[
-
2
]
==
'e'
else
self
.
platform
)
all_clk_count
=
con_sql
(
sql_all
)[
0
][
0
]
all_clk_count
=
con_sql
(
sql_all
)[
0
][
0
]
cid_clk_rate
=
round
(
cid_clk_count
/
all_clk_count
,
4
)
cid_clk_rate
=
round
(
cid_clk_count
/
all_clk_count
,
4
)
...
@@ -41,11 +41,11 @@ class CidRate(object):
...
@@ -41,11 +41,11 @@ class CidRate(object):
rtype : list
rtype : list
"""
"""
sql_cid
=
"select count(cid) from data_feed_exposure2
\
sql_cid
=
"select count(cid) from data_feed_exposure2
\
where stat_date
>
'{0}'
\
where stat_date
=
'{0}'
\
and device_type{1} and cid_type='{2}'"
.
format
(
get_yesterday_date
(),
self
.
platform
,
self
.
cid_type
)
and device_type{1} and cid_type='{2}'"
.
format
(
get_yesterday_date
(),
self
.
platform
,
self
.
cid_type
)
cid_imp_count
=
con_sql
(
sql_cid
)[
0
][
0
]
cid_imp_count
=
con_sql
(
sql_cid
)[
0
][
0
]
sql_all
=
"select count(cid) from data_feed_exposure2
\
sql_all
=
"select count(cid) from data_feed_exposure2
\
where stat_date
>
'{0}'
\
where stat_date
=
'{0}'
\
and device_type{1}"
.
format
(
get_yesterday_date
(),
self
.
platform
)
and device_type{1}"
.
format
(
get_yesterday_date
(),
self
.
platform
)
all_imp_count
=
con_sql
(
sql_all
)[
0
][
0
]
all_imp_count
=
con_sql
(
sql_all
)[
0
][
0
]
cid_imp_rate
=
round
(
cid_imp_count
/
all_imp_count
,
4
)
cid_imp_rate
=
round
(
cid_imp_count
/
all_imp_count
,
4
)
...
...
eda/recommended_indexs/clkCidUidRate.py
View file @
ce50f559
...
@@ -25,13 +25,13 @@ class ClkCidUidRate(object):
...
@@ -25,13 +25,13 @@ class ClkCidUidRate(object):
rtype : list
rtype : list
"""
"""
sql_clk
=
"select count(distinct(device_id)) from data_feed_click2
\
sql_clk
=
"select count(distinct(device_id)) from data_feed_click2
\
where stat_date
>
'{0}'
\
where stat_date
=
'{0}'
\
and device_type{1}
\
and device_type{1}
\
and cid_type{2}"
.
format
(
get_yesterday_date
(),
self
.
platform
.
replace
(
' '
,
''
)
if
self
.
platform
[
-
2
]
==
'e'
else
self
.
platform
,
self
.
cid_type
)
and cid_type{2}"
.
format
(
get_yesterday_date
(),
self
.
platform
.
replace
(
' '
,
''
)
if
self
.
platform
[
-
2
]
==
'e'
else
self
.
platform
,
self
.
cid_type
)
clk_count
=
con_sql
(
sql_clk
)[
0
][
0
]
clk_count
=
con_sql
(
sql_clk
)[
0
][
0
]
sql_imp
=
"select count(distinct(device_id)) from data_feed_exposure2
\
sql_imp
=
"select count(distinct(device_id)) from data_feed_exposure2
\
where stat_date
>
'{0}'
\
where stat_date
=
'{0}'
\
and device_type{1}
\
and device_type{1}
\
and cid_type{2}"
.
format
(
get_yesterday_date
(),
self
.
platform
,
self
.
cid_type
)
and cid_type{2}"
.
format
(
get_yesterday_date
(),
self
.
platform
,
self
.
cid_type
)
imp_count
=
con_sql
(
sql_imp
)[
0
][
0
]
imp_count
=
con_sql
(
sql_imp
)[
0
][
0
]
...
...
eda/recommended_indexs/func.py
View file @
ce50f559
...
@@ -17,14 +17,14 @@ def get_activate_uid_ctr(platform):
...
@@ -17,14 +17,14 @@ def get_activate_uid_ctr(platform):
else
:
else
:
platform
=
" is not null"
platform
=
" is not null"
sql_clk
=
"select count(device_id) from data_feed_click2
\
sql_clk
=
"select count(device_id) from data_feed_click2
\
where stat_date
>
'{0}'
\
where stat_date
=
'{0}'
\
and device_type{1}"
.
format
(
get_yesterday_date
(),
platform
.
replace
(
' '
,
''
)
if
platform
[
-
2
]
==
'e'
else
platform
)
and device_type{1}"
.
format
(
get_yesterday_date
(),
platform
.
replace
(
' '
,
''
)
if
platform
[
-
2
]
==
'e'
else
platform
)
clk_count
=
con_sql
(
sql_clk
)[
0
][
0
]
clk_count
=
con_sql
(
sql_clk
)[
0
][
0
]
sql_imp
=
"select count(device_id) from data_feed_exposure2
\
sql_imp
=
"select count(device_id) from data_feed_exposure2
\
where stat_date
>
'{0}'
\
where stat_date
=
'{0}'
\
and device_id in
\
and device_id in
\
(select device_id from data_feed_click2
\
(select device_id from data_feed_click2
\
where stat_date
>
'{0}'
\
where stat_date
=
'{0}'
\
and device_type{1})
\
and device_type{1})
\
and device_type{2}"
.
format
(
get_yesterday_date
(),
platform
.
replace
(
' '
,
''
)
if
platform
[
-
2
]
==
'e'
else
platform
,
platform
)
and device_type{2}"
.
format
(
get_yesterday_date
(),
platform
.
replace
(
' '
,
''
)
if
platform
[
-
2
]
==
'e'
else
platform
,
platform
)
imp_count
=
con_sql
(
sql_imp
)[
0
][
0
]
imp_count
=
con_sql
(
sql_imp
)[
0
][
0
]
...
@@ -48,15 +48,15 @@ def get_activate_uid_imp_times(city):
...
@@ -48,15 +48,15 @@ def get_activate_uid_imp_times(city):
else
:
else
:
city
=
" is not null"
city
=
" is not null"
sql_uid
=
"select count(distinct(device_id)) from data_feed_click2
\
sql_uid
=
"select count(distinct(device_id)) from data_feed_click2
\
where stat_date
>
'{0}'
\
where stat_date
=
'{0}'
\
and city_id{1}"
.
format
(
get_yesterday_date
(),
city
)
and city_id{1}"
.
format
(
get_yesterday_date
(),
city
)
sql_uid_count
=
con_sql
(
sql_uid
)[
0
][
0
]
sql_uid_count
=
con_sql
(
sql_uid
)[
0
][
0
]
sql_imp
=
"select count(device_id) from data_feed_exposure2
\
sql_imp
=
"select count(device_id) from data_feed_exposure2
\
where device_id in
\
where device_id in
\
(select device_id from data_feed_click2
\
(select device_id from data_feed_click2
\
where stat_date
>
'{0}'
\
where stat_date
=
'{0}'
\
and city_id{1})
\
and city_id{1})
\
and stat_date
>
'{0}'
\
and stat_date
=
'{0}'
\
and city_id{1}"
.
format
(
get_yesterday_date
(),
city
)
and city_id{1}"
.
format
(
get_yesterday_date
(),
city
)
sql_imp_times
=
con_sql
(
sql_imp
)[
0
][
0
]
sql_imp_times
=
con_sql
(
sql_imp
)[
0
][
0
]
if
city
==
"='beijing'"
:
if
city
==
"='beijing'"
:
...
...
eda/recommended_indexs/topFeatures.py
View file @
ce50f559
...
@@ -23,7 +23,7 @@ class TopFeatures(object):
...
@@ -23,7 +23,7 @@ class TopFeatures(object):
def
get_click_times
(
self
):
def
get_click_times
(
self
):
# rtype : dict
# rtype : dict
sql
=
"select cid,count(cid) from data_feed_click2
\
sql
=
"select cid,count(cid) from data_feed_click2
\
where stat_date
>
'{0}'
\
where stat_date
=
'{0}'
\
and device_type{1} and cid_type='{2}'
\
and device_type{1} and cid_type='{2}'
\
group by cid
\
group by cid
\
order by count(cid) desc"
.
format
(
get_yesterday_date
(),
self
.
platform
.
replace
(
' '
,
''
)
if
self
.
platform
[
-
2
]
==
'e'
else
self
.
platform
,
self
.
cid_type
)
order by count(cid) desc"
.
format
(
get_yesterday_date
(),
self
.
platform
.
replace
(
' '
,
''
)
if
self
.
platform
[
-
2
]
==
'e'
else
self
.
platform
,
self
.
cid_type
)
...
@@ -34,7 +34,7 @@ class TopFeatures(object):
...
@@ -34,7 +34,7 @@ class TopFeatures(object):
def
get_impression_times
(
self
):
def
get_impression_times
(
self
):
# rtype : dict
# rtype : dict
sql
=
"select cid,count(cid) from data_feed_exposure2
\
sql
=
"select cid,count(cid) from data_feed_exposure2
\
where stat_date
>
'{0}'
\
where stat_date
=
'{0}'
\
and device_type{1} and cid_type='{2}'
\
and device_type{1} and cid_type='{2}'
\
group by cid order by count(cid) desc"
.
format
(
get_yesterday_date
(),
self
.
platform
,
self
.
cid_type
)
group by cid order by count(cid) desc"
.
format
(
get_yesterday_date
(),
self
.
platform
,
self
.
cid_type
)
imp_times
=
tuple2dict
(
con_sql
(
sql
))
imp_times
=
tuple2dict
(
con_sql
(
sql
))
...
...
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