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
3a567ba0
Commit
3a567ba0
authored
5 years ago
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change test file
parent
7651ce0f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
27 deletions
+21
-27
feature_engineering.py
eda/esmm/Model_pipline/feature_engineering.py
+8
-9
hello.py
hello.py
+13
-18
No files found.
eda/esmm/Model_pipline/feature_engineering.py
View file @
3a567ba0
...
@@ -104,15 +104,15 @@ def feature_engineer():
...
@@ -104,15 +104,15 @@ def feature_engineer():
unique_values
=
[]
unique_values
=
[]
db
=
pymysql
.
connect
(
host
=
'172.16.40.158'
,
port
=
4000
,
user
=
'root'
,
passwd
=
'3SYz54LS9#^9sBvC'
,
db
=
'jerry_test'
)
db
=
pymysql
.
connect
(
host
=
'172.16.40.158'
,
port
=
4000
,
user
=
'root'
,
passwd
=
'3SYz54LS9#^9sBvC'
,
db
=
'jerry_test'
)
sql
=
"select distinct stat_date from esmm_train_data_dwell
_share_test
"
sql
=
"select distinct stat_date from esmm_train_data_dwell"
unique_values
.
extend
(
get_unique
(
db
,
sql
))
unique_values
.
extend
(
get_unique
(
db
,
sql
))
db
=
pymysql
.
connect
(
host
=
'172.16.40.158'
,
port
=
4000
,
user
=
'root'
,
passwd
=
'3SYz54LS9#^9sBvC'
,
db
=
'jerry_test'
)
db
=
pymysql
.
connect
(
host
=
'172.16.40.158'
,
port
=
4000
,
user
=
'root'
,
passwd
=
'3SYz54LS9#^9sBvC'
,
db
=
'jerry_test'
)
sql
=
"select distinct ucity_id from esmm_train_data_dwell
_share_test
"
sql
=
"select distinct ucity_id from esmm_train_data_dwell"
unique_values
.
extend
(
get_unique
(
db
,
sql
))
unique_values
.
extend
(
get_unique
(
db
,
sql
))
db
=
pymysql
.
connect
(
host
=
'172.16.40.158'
,
port
=
4000
,
user
=
'root'
,
passwd
=
'3SYz54LS9#^9sBvC'
,
db
=
'jerry_test'
)
db
=
pymysql
.
connect
(
host
=
'172.16.40.158'
,
port
=
4000
,
user
=
'root'
,
passwd
=
'3SYz54LS9#^9sBvC'
,
db
=
'jerry_test'
)
sql
=
"select distinct ccity_name from esmm_train_data_dwell
_share_test
"
sql
=
"select distinct ccity_name from esmm_train_data_dwell"
unique_values
.
extend
(
get_unique
(
db
,
sql
))
unique_values
.
extend
(
get_unique
(
db
,
sql
))
db
=
pymysql
.
connect
(
host
=
'172.16.40.158'
,
port
=
4000
,
user
=
'root'
,
passwd
=
'3SYz54LS9#^9sBvC'
,
db
=
'jerry_test'
)
db
=
pymysql
.
connect
(
host
=
'172.16.40.158'
,
port
=
4000
,
user
=
'root'
,
passwd
=
'3SYz54LS9#^9sBvC'
,
db
=
'jerry_test'
)
...
@@ -162,7 +162,7 @@ def feature_engineer():
...
@@ -162,7 +162,7 @@ def feature_engineer():
# unique_values.append("video")
# unique_values.append("video")
db
=
pymysql
.
connect
(
host
=
'172.16.40.158'
,
port
=
4000
,
user
=
'root'
,
passwd
=
'3SYz54LS9#^9sBvC'
,
db
=
'jerry_test'
)
db
=
pymysql
.
connect
(
host
=
'172.16.40.158'
,
port
=
4000
,
user
=
'root'
,
passwd
=
'3SYz54LS9#^9sBvC'
,
db
=
'jerry_test'
)
sql
=
"select max(stat_date) from esmm_train_data_dwell
_share_test
"
sql
=
"select max(stat_date) from esmm_train_data_dwell"
validate_date
=
con_sql
(
db
,
sql
)[
0
]
.
values
.
tolist
()[
0
]
validate_date
=
con_sql
(
db
,
sql
)[
0
]
.
values
.
tolist
()[
0
]
print
(
"validate_date:"
+
validate_date
)
print
(
"validate_date:"
+
validate_date
)
temp
=
datetime
.
datetime
.
strptime
(
validate_date
,
"
%
Y-
%
m-
%
d"
)
temp
=
datetime
.
datetime
.
strptime
(
validate_date
,
"
%
Y-
%
m-
%
d"
)
...
@@ -170,7 +170,7 @@ def feature_engineer():
...
@@ -170,7 +170,7 @@ def feature_engineer():
print
(
start
)
print
(
start
)
db
=
pymysql
.
connect
(
host
=
'172.16.40.158'
,
port
=
4000
,
user
=
'root'
,
passwd
=
'3SYz54LS9#^9sBvC'
)
db
=
pymysql
.
connect
(
host
=
'172.16.40.158'
,
port
=
4000
,
user
=
'root'
,
passwd
=
'3SYz54LS9#^9sBvC'
)
sql
=
"select distinct doctor.hospital_id from jerry_test.esmm_train_data_dwell
_share_test
e "
\
sql
=
"select distinct doctor.hospital_id from jerry_test.esmm_train_data_dwell e "
\
"left join eagle.src_zhengxing_api_service service on e.diary_service_id = service.id "
\
"left join eagle.src_zhengxing_api_service service on e.diary_service_id = service.id "
\
"left join eagle.src_zhengxing_api_doctor doctor on service.doctor_id = doctor.id "
\
"left join eagle.src_zhengxing_api_doctor doctor on service.doctor_id = doctor.id "
\
"where e.stat_date >= '{}'"
.
format
(
start
)
"where e.stat_date >= '{}'"
.
format
(
start
)
...
@@ -196,7 +196,7 @@ def feature_engineer():
...
@@ -196,7 +196,7 @@ def feature_engineer():
"ot.tag as tag5,sixin.tag as tag6,cart.tag as tag7,doris.search_tag2,doris.search_tag3,"
\
"ot.tag as tag5,sixin.tag as tag6,cart.tag as tag7,doris.search_tag2,doris.search_tag3,"
\
"k.treatment_method,k.price_min,k.price_max,k.treatment_time,k.maintain_time,k.recover_time,"
\
"k.treatment_method,k.price_min,k.price_max,k.treatment_time,k.maintain_time,k.recover_time,"
\
"e.device_id,e.cid_id "
\
"e.device_id,e.cid_id "
\
"from jerry_test.esmm_train_data_dwell
_share_test
e left join jerry_test.user_feature u on e.device_id = u.device_id "
\
"from jerry_test.esmm_train_data_dwell e left join jerry_test.user_feature u on e.device_id = u.device_id "
\
"left join jerry_test.cid_type_top c on e.device_id = c.device_id "
\
"left join jerry_test.cid_type_top c on e.device_id = c.device_id "
\
"left join jerry_test.cid_time_cut cut on e.cid_id = cut.cid "
\
"left join jerry_test.cid_time_cut cut on e.cid_id = cut.cid "
\
"left join jerry_test.device_app_list dl on e.device_id = dl.device_id "
\
"left join jerry_test.device_app_list dl on e.device_id = dl.device_id "
\
...
@@ -261,7 +261,7 @@ def feature_engineer():
...
@@ -261,7 +261,7 @@ def feature_engineer():
print
(
"训练集样本总量:"
)
print
(
"训练集样本总量:"
)
print
(
rdd
.
count
())
print
(
rdd
.
count
())
#
get_pre_number()
get_pre_number
()
test
=
rdd
.
filter
(
lambda
x
:
x
[
0
]
==
validate_date
)
.
map
(
test
=
rdd
.
filter
(
lambda
x
:
x
[
0
]
==
validate_date
)
.
map
(
lambda
x
:
(
x
[
1
],
x
[
2
],
x
[
3
],
x
[
4
],
x
[
5
],
x
[
6
],
x
[
7
],
x
[
8
],
x
[
9
],
lambda
x
:
(
x
[
1
],
x
[
2
],
x
[
3
],
x
[
4
],
x
[
5
],
x
[
6
],
x
[
7
],
x
[
8
],
x
[
9
],
...
@@ -301,8 +301,7 @@ def get_predict(date,value_map,app_list_map,leve2_map,leve3_map):
...
@@ -301,8 +301,7 @@ def get_predict(date,value_map,app_list_map,leve2_map,leve3_map):
"left join jerry_test.sixin_tag sixin on e.device_id = sixin.device_id "
\
"left join jerry_test.sixin_tag sixin on e.device_id = sixin.device_id "
\
"left join jerry_test.cart_tag cart on e.device_id = cart.device_id "
\
"left join jerry_test.cart_tag cart on e.device_id = cart.device_id "
\
"left join jerry_test.knowledge k on feat.level2 = k.level2_id "
\
"left join jerry_test.knowledge k on feat.level2 = k.level2_id "
\
"left join jerry_test.search_doris doris on e.device_id = doris.device_id and e.stat_date = doris.get_date "
\
"left join jerry_test.search_doris doris on e.device_id = doris.device_id and e.stat_date = doris.get_date"
"where e.device_id = 'C33E2C8E-86E9-4C91-8458-526FB81E4C78'"
features
=
[
"ucity_id"
,
"ccity_name"
,
"device_type"
,
"manufacturer"
,
features
=
[
"ucity_id"
,
"ccity_name"
,
"device_type"
,
"manufacturer"
,
"channel"
,
"top"
,
"time"
,
"hospital_id"
,
"channel"
,
"top"
,
"time"
,
"hospital_id"
,
...
...
This diff is collapsed.
Click to expand it.
hello.py
View file @
3a567ba0
...
@@ -18,28 +18,13 @@ city = "beijing" # beijing
...
@@ -18,28 +18,13 @@ city = "beijing" # beijing
s
=
requests
.
session
()
s
=
requests
.
session
()
def
get_d
():
def
get_d
():
url
=
"https://backend.igengmei.com/
api/tractate/list?t=1565668444141&version=7.12.6&hybrid=true&channel=App
%20
Store¤t_city_id={}&device_id={}&idfa=B6712382-69D5-4B12-9810-5F266411C4CF&idfv=E6937620-F372-434B-9084-9A9580573838&lat=40.00190424107359&lng=116.4871480941339&platform=iPhone&os_version=11.4.1&json=&tractate_id=42124&start_num=0&from=&data_type=user_post"
.
format
(
city
,
device_IOS
)
url
=
"https://backend.igengmei.com/
hybrid/answer_detail/_data?count=10&id=684331&t=1565678678155&version=7.12.6&hybrid=true&channel=App
%20
Store¤t_city_id={}&device_id={}&idfa=B6712382-69D5-4B12-9810-5F266411C4CF&idfv=E6937620-F372-434B-9084-9A9580573838&lat=40.00460770016659&lng=116.4882663515051&platform=iPhone&os_version=11.4.1"
.
format
(
city
,
device_IOS
)
a
=
s
.
get
(
url
,
verify
=
False
)
a
=
s
.
get
(
url
,
verify
=
False
)
aa
=
a
.
json
()
aa
=
a
.
json
()
return
aa
return
aa
def
mysql
(
device_Android
):
db
=
pymysql
.
connect
(
host
=
'172.16.30.136'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm'
,
db
=
'doris_prod'
)
sql
=
"select queue from device_user_topic_queue where device_id = '{}'"
.
format
(
device_Android
)
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
)
result
=
cursor
.
fetchone
()
db
.
close
()
l
=
result
[
0
]
.
split
(
","
)
print
(
l
)
return
l
def
get_chapter
(
id
):
def
get_chapter
(
id
):
"""
"""
topic 帖子
topic 帖子
...
@@ -168,7 +153,7 @@ def get_chapter(id):
...
@@ -168,7 +153,7 @@ def get_chapter(id):
def
get_opreaton
():
def
get_opreaton
():
db
=
pymysql
.
connect
(
host
=
'172.16.30.143'
,
port
=
3306
,
user
=
'work'
,
passwd
=
'BJQaT9VzDcuPBqkd'
,
db
=
'zhengxing'
)
db
=
pymysql
.
connect
(
host
=
'172.16.30.143'
,
port
=
3306
,
user
=
'work'
,
passwd
=
'BJQaT9VzDcuPBqkd'
,
db
=
'zhengxing'
)
sql
=
"SELECT GROUP_CONCAT(distinct card_id) from api_feedoperatev2 "
\
sql
=
"SELECT GROUP_CONCAT(distinct card_id) from api_feedoperatev2 "
\
"where card_type =
19
and is_online = 1 and end_time >= '2019-08-13' and start_time <='2019-08-13'"
"where card_type =
26
and is_online = 1 and end_time >= '2019-08-13' and start_time <='2019-08-13'"
cursor
=
db
.
cursor
()
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
)
cursor
.
execute
(
sql
)
result
=
cursor
.
fetchone
()
result
=
cursor
.
fetchone
()
...
@@ -178,6 +163,16 @@ def get_opreaton():
...
@@ -178,6 +163,16 @@ def get_opreaton():
print
(
l
)
print
(
l
)
return
l
return
l
def
mysql
(
device_Android
):
db
=
pymysql
.
connect
(
host
=
'172.16.30.136'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm'
,
db
=
'doris_prod'
)
sql
=
"select queue from device_qa_queue where device_id = '{}'"
.
format
(
device_Android
)
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
)
result
=
cursor
.
fetchone
()
db
.
close
()
l
=
result
[
0
]
.
split
(
","
)
print
(
l
)
return
l
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
get_d
()
get_d
()
...
...
This diff is collapsed.
Click to expand it.
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