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
57066c01
Commit
57066c01
authored
Aug 29, 2019
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change test file
parent
eef3fcd3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
14 deletions
+16
-14
rerank_esmm.py
rerank_esmm.py
+16
-14
No files found.
rerank_esmm.py
View file @
57066c01
...
@@ -28,9 +28,6 @@ def get_user_profile(device_id = "9C5E7C73-380C-4623-8F48-A64C8034E315"):
...
@@ -28,9 +28,6 @@ def get_user_profile(device_id = "9C5E7C73-380C-4623-8F48-A64C8034E315"):
tag_score
[
i
[
"content"
]]
=
i
[
"score"
]
tag_score
[
i
[
"content"
]]
=
i
[
"score"
]
elif
i
[
"content"
]
in
name_tag
.
keys
():
elif
i
[
"content"
]
in
name_tag
.
keys
():
tag_score
[
name_tag
[
i
[
"content"
]]]
=
i
[
"score"
]
tag_score
[
name_tag
[
i
[
"content"
]]]
=
i
[
"score"
]
print
(
tag_score
)
tag_sort
=
sorted
(
tag_score
.
items
(),
key
=
lambda
x
:
x
[
1
],
reverse
=
True
)
tag_sort
=
sorted
(
tag_score
.
items
(),
key
=
lambda
x
:
x
[
1
],
reverse
=
True
)
tags
=
[]
tags
=
[]
if
len
(
tag_sort
)
>
5
:
if
len
(
tag_sort
)
>
5
:
...
@@ -40,10 +37,9 @@ def get_user_profile(device_id = "9C5E7C73-380C-4623-8F48-A64C8034E315"):
...
@@ -40,10 +37,9 @@ def get_user_profile(device_id = "9C5E7C73-380C-4623-8F48-A64C8034E315"):
for
i
in
tag_sort
:
for
i
in
tag_sort
:
tags
.
append
(
i
[
0
])
tags
.
append
(
i
[
0
])
print
(
tags
)
return
tags
return
tags
def
get_searchworlds_to_tagid
():
def
get_searchworlds_to_tagid
():
try
:
try
:
sql
=
'select id, name from api_tag where is_online = 1 and tag_type < 4'
sql
=
'select id, name from api_tag where is_online = 1 and tag_type < 4'
...
@@ -63,17 +59,23 @@ def get_searchworlds_to_tagid():
...
@@ -63,17 +59,23 @@ def get_searchworlds_to_tagid():
print
(
e
)
print
(
e
)
def
transform_to_tag
(
user_profile
):
def
transform_to_tag
(
user_profile
):
pass
pass
def
get_queues
(
device_id
,
city_id
):
def
get_queues
(
device_id
,
city_id
):
pass
db
=
pymysql
.
connect
(
host
=
'172.16.40.158'
,
port
=
4000
,
user
=
'root'
,
passwd
=
'3SYz54LS9#^9sBvC'
,
db
=
'jerry_test'
)
cursor
=
db
.
cursor
()
sql
=
"select native_queue,nearby_queue,nation_queue,megacity_queue from esmm_device_diary_queue "
\
"where device_id = '{}' and city_id = '{}' limit 1"
.
format
(
device_id
,
city_id
)
cursor
.
execute
(
sql
)
# if 判断是不是空
result
=
list
(
cursor
.
fetchall
())
print
(
result
)
result
=
list
(
cursor
.
fetchone
())
print
(
result
)
return
result
def
tag_boost
(
cid_list
,
tag_score
):
def
tag_boost
(
cid_list
,
tag_score
):
...
@@ -91,10 +93,9 @@ def make_sample(uid,city_id,native_queue,nearby_queue,megacity_queue,nation_queu
...
@@ -91,10 +93,9 @@ def make_sample(uid,city_id,native_queue,nearby_queue,megacity_queue,nation_queu
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
# users_list = get_esmm_users()
# users_list = get_esmm_users()
# total_samples = list()
# total_samples = list()
name_tag
=
get_searchworlds_to_tagid
()
# name_tag = get_searchworlds_to_tagid()
get_user_profile
()
# for i in users_list:
# for i in users_list:
# tag_
score
= get_user_profile(i[0])
# tag_
list
= get_user_profile(i[0])
# native,nearby,megacity,nation = get_queues(i[0],i[1])
# native,nearby,megacity,nation = get_queues(i[0],i[1])
#
#
# native_sort_list = tag_boost(native, tag_score)
# native_sort_list = tag_boost(native, tag_score)
...
@@ -106,6 +107,7 @@ if __name__ == "__main__":
...
@@ -106,6 +107,7 @@ if __name__ == "__main__":
# total_samples.todf
# total_samples.todf
# to_data_base(df)
# to_data_base(df)
# to kv
# to kv
get_queues
(
"868973042175678"
,
"beijing"
)
...
...
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