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
70cb568f
Commit
70cb568f
authored
May 21, 2020
by
任婷婷
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
71558f3b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
9 deletions
+11
-9
tag3_update_user_portrait_offline.py
eda/smart_rank/tag3_update_user_portrait_offline.py
+9
-6
test_divided_portrait.py
eda/smart_rank/test_divided_portrait.py
+1
-1
tool.py
eda/smart_rank/tool.py
+1
-2
No files found.
eda/smart_rank/tag3_update_user_portrait_offline.py
View file @
70cb568f
...
@@ -29,6 +29,8 @@ def make_dict_from_pair(x):
...
@@ -29,6 +29,8 @@ def make_dict_from_pair(x):
def
update_tag3_user_portrait
(
cl_id
):
def
update_tag3_user_portrait
(
cl_id
):
user_df
=
get_tag3_user_log
(
cl_id
)
user_df
=
get_tag3_user_log
(
cl_id
)
print
(
'*'
*
100
)
print
(
'user_df'
,
user_df
)
if
not
user_df
.
empty
:
if
not
user_df
.
empty
:
user_df
[
"first_solutions"
]
=
list
(
zip
(
user_df
[
"first_solutions"
]
.
apply
(
lambda
x
:
x
.
split
(
","
)),
user_df
[
"tag_score"
]))
user_df
[
"first_solutions"
]
=
list
(
zip
(
user_df
[
"first_solutions"
]
.
apply
(
lambda
x
:
x
.
split
(
","
)),
user_df
[
"tag_score"
]))
user_df
[
"second_solutions"
]
=
list
(
zip
(
user_df
[
"second_solutions"
]
.
apply
(
lambda
x
:
x
.
split
(
","
)),
user_df
[
"tag_score"
]))
user_df
[
"second_solutions"
]
=
list
(
zip
(
user_df
[
"second_solutions"
]
.
apply
(
lambda
x
:
x
.
split
(
","
)),
user_df
[
"tag_score"
]))
...
@@ -96,10 +98,10 @@ def update_tag3_user_portrait(cl_id):
...
@@ -96,10 +98,10 @@ def update_tag3_user_portrait(cl_id):
# redis_client.set(key2, json.dumps(res2))
# redis_client.set(key2, json.dumps(res2))
# redis_client.expire(key2, 60 * 60 * 24 * 30)
# redis_client.expire(key2, 60 * 60 * 24 * 30)
# print('*'*10)
# print('*'*10)
write_user_portrait
(
cl_id
,
","
.
join
(
first_solutions_score
.
keys
()),
","
.
join
(
second_solutions_score
.
keys
()),
#
write_user_portrait(cl_id, ",".join(first_solutions_score.keys()), ",".join(second_solutions_score.keys()),
","
.
join
(
first_demands_score
.
keys
()),
","
.
join
(
second_demands_score
.
keys
()),
#
",".join(first_demands_score.keys()), ",".join(second_demands_score.keys()),
","
.
join
(
first_positions_score
.
keys
()),
","
.
join
(
second_positions_score
.
keys
()),
#
",".join(first_positions_score.keys()), ",".join(second_positions_score.keys()),
","
.
join
(
projects_score
.
keys
()))
#
",".join(projects_score.keys()))
first_solutions
=
[]
first_solutions
=
[]
first_positions
=
[]
first_positions
=
[]
...
@@ -111,12 +113,13 @@ def update_tag3_user_portrait(cl_id):
...
@@ -111,12 +113,13 @@ def update_tag3_user_portrait(cl_id):
# cl_ids = [1, 3]
# cl_ids = [1, 3]
print
(
'*'
*
100
)
print
(
'*'
*
100
)
print
(
'cl_ids'
,
cl_id
)
print
(
'INPUT cl_ids:'
,
cl_id
)
print
(
'OUTPUT data:'
)
print
(
data
)
data
=
user_portrait_action_statistic
(
cl_id
)
data
=
user_portrait_action_statistic
(
cl_id
)
for
key
,
values
in
data
.
items
():
for
key
,
values
in
data
.
items
():
cl_id_single
=
key
cl_id_single
=
key
print
(
"val"
,
values
.
keys
())
for
item
in
values
.
keys
():
for
item
in
values
.
keys
():
if
values
[
item
]:
if
values
[
item
]:
first_solutions
=
values
[
item
]
.
get
(
"first_solutions"
,
[])
first_solutions
=
values
[
item
]
.
get
(
"first_solutions"
,
[])
...
...
eda/smart_rank/test_divided_portrait.py
View file @
70cb568f
...
@@ -120,7 +120,7 @@ if __name__ == '__main__':
...
@@ -120,7 +120,7 @@ if __name__ == '__main__':
projects
=
[]
projects
=
[]
# cl_ids = [1,3]
# cl_ids = [1,3]
cl_ids
=
[
'3D878D3E-9C19-4CC9-BB7A-0082B38996F2'
,
'03BF3310-C5AF-4049-8041-DC5ECE927A81'
]
cl_ids
=
'3D878D3E-9C19-4CC9-BB7A-0082B38996F2'
data
=
user_portrait_action_statistic
(
cl_ids
)
data
=
user_portrait_action_statistic
(
cl_ids
)
for
key
,
values
in
data
.
items
():
for
key
,
values
in
data
.
items
():
...
...
eda/smart_rank/tool.py
View file @
70cb568f
...
@@ -446,8 +446,7 @@ def get_user_portrait_log(cl_id):
...
@@ -446,8 +446,7 @@ def get_user_portrait_log(cl_id):
# try:
# try:
sql
=
"""select cl_id,event_cn, first_solutions, second_solutions, first_demands,
sql
=
"""select cl_id,event_cn, first_solutions, second_solutions, first_demands,
second_demands, first_positions, second_positions, projects
second_demands, first_positions, second_positions, projects
from kafka_tag3_log where cl_id in {} """
.
format
(
tuple
(
cl_id
))
from kafka_tag3_log where cl_id = '{}' """
.
format
(
cl_id
)
print
(
"sql"
,
sql
)
db
,
cursor
=
get_jerry_test
()
db
,
cursor
=
get_jerry_test
()
cursor
.
execute
(
sql
)
cursor
.
execute
(
sql
)
data
=
list
(
cursor
.
fetchall
())
data
=
list
(
cursor
.
fetchall
())
...
...
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