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
c91d1fa0
Commit
c91d1fa0
authored
Mar 11, 2020
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
96c0590d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
17 deletions
+10
-17
ai_test.py
ai_test.py
+2
-9
ctr_exp.py
ctr_exp.py
+1
-0
make_data.py
make_data.py
+7
-8
No files found.
ai_test.py
View file @
c91d1fa0
...
...
@@ -3,19 +3,12 @@ import json
import
requests
# url="http://127.0.0.1:4050/v1/once"
url
=
"http://doris.paas.test/v1/once"
url
=
"http://doctor.paas.env/v1/once"
# 如果在生产环境doris 01上执行,把url改成"http://127.0.0.1:4050/v1/once"
header_dict
=
{
'Content-Type'
:
'application/x-www-form-urlencoded'
}
param_dict
=
{}
# param_dict["method"]="doris/search/doctor_officer"
# 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":[]}
diary_list
=
[
9462756
,
9462737
,
9462730
,
9462719
]
param_dict
[
"method"
]
=
"doris/search/diary_score"
# param_dict["method"]="doris/search/diary_score"
param_detail
=
{
"diary_list"
:
diary_list
}
...
...
ctr_exp.py
View file @
c91d1fa0
...
...
@@ -12,6 +12,7 @@ def get_yesterday_date():
print
(
yesterday
)
return
yesterday
def
ctr_all
():
db
=
pymysql
.
connect
(
host
=
'10.66.157.22'
,
port
=
4000
,
user
=
'root'
,
passwd
=
'3SYz54LS9#^9sBvC'
,
db
=
'jerry_prod'
)
cursor
=
db
.
cursor
()
...
...
make_data.py
View file @
c91d1fa0
...
...
@@ -4,7 +4,6 @@ import pandas as pd
def
hospital
():
date_str
=
"20200101"
sql
=
"select api.id,"
\
"h.hospital_id,h.hospital_exposure_pv_30,h.service_exposure_pv_30,h.expert_exposure_pv_30,"
\
"h.service_ctr_30,h.hospital_ctr_30,h.expert_ctr_30,b.merchant_id,"
\
...
...
@@ -57,9 +56,9 @@ def hospital():
df
.
loc
[
df
[
"all_exposure"
]
<=
3000
,
[
"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
df
.
loc
[
df
[
"cpt"
]
>
3
,
[
"cpt"
]]
=
3
df
.
loc
[
df
[
"cpt"
]
<
0.01
,
[
"cpt"
]]
=
0.01
df
.
loc
[
df
[
"commission"
]
>
10
,
[
"commission"
]]
=
10
df
.
loc
[
df
[
"commission"
]
>
3
,
[
"commission"
]]
=
3
df
.
loc
[
df
[
"commission"
]
<
0.01
,
[
"commission"
]]
=
0.01
df
[
"score"
]
=
df
[
"ctr"
]
**
0.5
*
(
df
[
"commission"
]
+
df
[
"cpt"
])
...
...
@@ -74,11 +73,10 @@ def hospital():
data
=
data
.
drop_duplicates
()
print
(
data
.
shape
)
data
.
to_csv
(
'/tmp/
26
_hospital.csv'
,
index
=
False
)
data
.
to_csv
(
'/tmp/
30
_hospital.csv'
,
index
=
False
)
def
new_doctor
():
date_str
=
"20200101"
sql
=
"select d.doctor_id,d.service_exposure_pv_30,d.service_ctr_30,d.expert_exposure_pv_30,"
\
"d.expert_pv_30,b.merchant_id,m.doctor_discount_30_days,m.expand_rechange_amount_30,"
\
"m.service_pv_30,m.expert_pv_30,m.organization_pv_30 from statistic_doctor_rank_factor d "
\
...
...
@@ -125,9 +123,9 @@ def new_doctor():
df
.
loc
[
df
[
"all_exposure"
]
<=
3000
,
[
"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
df
.
loc
[
df
[
"commission"
]
>
3
,
[
"commission"
]]
=
3
df
.
loc
[
df
[
"commission"
]
<
0.01
,
[
"commission"
]]
=
0.01
df
.
loc
[
df
[
"pv_ad"
]
>
10
,
[
"pv_ad"
]]
=
10
df
.
loc
[
df
[
"pv_ad"
]
>
3
,
[
"pv_ad"
]]
=
3
df
.
loc
[
df
[
"pv_ad"
]
<
0.01
,
[
"pv_ad"
]]
=
0.01
df
[
"score"
]
=
df
[
"ctr"
]
**
0.5
*
(
df
[
"commission"
]
+
df
[
"pv_ad"
])
...
...
@@ -141,11 +139,12 @@ def new_doctor():
data
=
data
.
drop_duplicates
()
print
(
data
.
shape
)
data
.
to_csv
(
'/tmp/
26
_doctor.csv'
,
index
=
False
)
data
.
to_csv
(
'/tmp/
30
_doctor.csv'
,
index
=
False
)
print
(
"doctor end"
)
if
__name__
==
"__main__"
:
date_str
=
"20200310"
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