Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
strategy_embedding
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rank
strategy_embedding
Commits
9491a0b9
Commit
9491a0b9
authored
Nov 27, 2020
by
赵威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
portrait performance
parent
5123d2da
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
personas.py
utils/personas.py
+7
-2
No files found.
utils/personas.py
View file @
9491a0b9
...
...
@@ -9,8 +9,13 @@ def get_user_portrait_tag3_redis_key(device_id):
def
items_gt_score
(
d
,
limit_score
=
0
,
tags_num
=
5
):
new_d
=
dict
(
sorted
(
d
.
items
(),
key
=
lambda
x
:
x
[
1
],
reverse
=
True
))
res
=
{
tag
:
float
(
score
)
for
tag
,
score
in
new_d
.
items
()
if
float
(
score
)
>=
limit_score
}
return
list
(
res
.
keys
())[:
tags_num
]
res
=
[]
count
=
0
for
(
tag
,
score
)
in
new_d
.
items
():
if
float
(
score
)
>=
limit_score
and
count
<
tags_num
:
res
.
append
(
tag
)
count
+=
1
return
res
def
get_user_portrait_tag3_from_redis
(
device_id
,
limit_score
=
0
,
tags_num
=
5
):
...
...
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