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
96c0590d
Commit
96c0590d
authored
Feb 26, 2020
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
ac22ea27
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
13 deletions
+13
-13
ai_test.py
ai_test.py
+7
-2
make_data.py
make_data.py
+6
-11
No files found.
ai_test.py
View file @
96c0590d
...
...
@@ -11,8 +11,13 @@ param_dict={}
# param_detail = {"device_id": 'xx',"size": 10,"offset":0, "query": "双眼皮","user_city_tag_id": 328,
# "is_officer":False,"filters":{}}
param_dict
[
"method"
]
=
"doris/search/bangdan"
param_detail
=
{
"device_id"
:
'2'
,
"size"
:
10
,
"offset"
:
0
,
"user_city_tag_id"
:
-
1
,
"is_officer"
:
False
,
"unit_ids"
:[]}
# param_dict["method"]="doris/search/bangdan"
# param_detail = {"device_id": '2',"size": 10,"offset":0, "user_city_tag_id": -1,"is_officer":False,"unit_ids":[]}
diary_list
=
[
9462756
,
9462737
,
9462730
,
9462719
]
param_dict
[
"method"
]
=
"doris/search/diary_score"
param_detail
=
{
"diary_list"
:
diary_list
}
# a = [105, 2941, 780, 102, 873, 2060, 187, 2935, 2108, 912, 928, 2059, 4437, 822, 2866, 2778, 824, 821, 2938]
...
...
make_data.py
View file @
96c0590d
...
...
@@ -16,7 +16,6 @@ def hospital():
"left join statistic_merchant_rank_factor m on b.merchant_id = m.merchant_id "
\
"where api.doctor_type = 1 and h.date = '{}' and m.partition_date = '{}';"
.
format
(
date_str
,
date_str
)
db
=
pymysql
.
connect
(
host
=
'172.16.30.141'
,
port
=
3306
,
user
=
'work'
,
passwd
=
'BJQaT9VzDcuPBqkd'
,
db
=
'zhengxing'
)
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
)
...
...
@@ -50,12 +49,12 @@ def hospital():
df
.
loc
[
df
[
"doctor_discount_30_days"
]
<
0
,
[
"doctor_discount_30_days"
]]
=
0
df
.
loc
[
df
[
"expand_rechange_amount_30"
]
<
0
,
[
"expand_rechange_amount_30"
]]
=
0
df
.
loc
[
df
[
"tmp"
]
<=
1500
,
[
"tmp"
]]
=
15
00
df
.
loc
[
df
[
"tmp"
]
<=
3000
,
[
"tmp"
]]
=
30
00
df
[
"commission"
]
=
df
[
"doctor_discount_30_days"
]
/
df
[
"tmp"
]
df
[
"cpt"
]
=
df
[
"expand_rechange_amount_30"
]
/
df
[
"tmp"
]
df
.
loc
[
df
[
"all_exposure"
]
<=
15
00
,
[
"ctr"
]]
=
0.01
df
.
loc
[
df
[
"all_exposure"
]
<=
30
00
,
[
"ctr"
]]
=
0.01
df
.
loc
[
df
[
"ctr"
]
<
0.01
,
[
"ctr"
]]
=
0.01
df
.
loc
[
df
[
"ctr"
]
>
0.2
,
[
"ctr"
]]
=
0.2
df
.
loc
[
df
[
"cpt"
]
>
10
,
[
"cpt"
]]
=
10
...
...
@@ -75,7 +74,7 @@ def hospital():
data
=
data
.
drop_duplicates
()
print
(
data
.
shape
)
data
.
to_csv
(
'/tmp/2
5
_hospital.csv'
,
index
=
False
)
data
.
to_csv
(
'/tmp/2
6
_hospital.csv'
,
index
=
False
)
def
new_doctor
():
...
...
@@ -112,7 +111,7 @@ def new_doctor():
print
(
"all_exposure"
)
print
(
df
.
shape
)
df
[
"tmp"
]
=
df
[
"service_pv_30"
]
+
df
[
"mexpert_pv_30"
]
+
df
[
"organization_pv_30"
]
df
.
loc
[
df
[
"tmp"
]
<=
1500
,
[
"tmp"
]]
=
15
00
df
.
loc
[
df
[
"tmp"
]
<=
3000
,
[
"tmp"
]]
=
30
00
df
[
"ctr"
]
=
df
[
"service_exposure_pv_30"
]
/
df
[
"all_exposure"
]
*
df
[
"service_ctr_30"
]
+
\
df
[
"expert_exposure_pv_30"
]
/
df
[
"all_exposure"
]
*
(
df
[
"expert_pv_30"
]
/
df
[
"expert_exposure_pv_30"
])
...
...
@@ -123,7 +122,7 @@ def new_doctor():
df
[
"commission"
]
=
df
[
"doctor_discount_30_days"
]
/
df
[
"tmp"
]
df
[
"pv_ad"
]
=
df
[
"expand_rechange_amount_30"
]
/
df
[
"tmp"
]
df
.
loc
[
df
[
"all_exposure"
]
<=
15
00
,
[
"ctr"
]]
=
0.01
df
.
loc
[
df
[
"all_exposure"
]
<=
30
00
,
[
"ctr"
]]
=
0.01
df
.
loc
[
df
[
"ctr"
]
<
0.01
,
[
"ctr"
]]
=
0.01
df
.
loc
[
df
[
"ctr"
]
>
0.2
,
[
"ctr"
]]
=
0.2
df
.
loc
[
df
[
"commission"
]
>
10
,
[
"commission"
]]
=
10
...
...
@@ -142,15 +141,11 @@ def new_doctor():
data
=
data
.
drop_duplicates
()
print
(
data
.
shape
)
data
.
to_csv
(
'/tmp/2
5
_doctor.csv'
,
index
=
False
)
data
.
to_csv
(
'/tmp/2
6
_doctor.csv'
,
index
=
False
)
print
(
"doctor end"
)
if
__name__
==
"__main__"
:
# doctor()
# hospital()
# old()
new_doctor
()
hospital
()
...
...
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