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
035053a0
Commit
035053a0
authored
Sep 06, 2019
by
高雅喆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
17a27d53
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
6 deletions
+14
-6
dist_update_portrait_market.py
eda/smart_rank/dist_update_portrait_market.py
+12
-4
dist_update_user_portrait_service.py
eda/smart_rank/dist_update_user_portrait_service.py
+2
-2
No files found.
eda/smart_rank/dist_update_portrait_market.py
View file @
035053a0
...
@@ -156,14 +156,22 @@ def get_user_tag_score(cl_id, all_word_tags, size=10):
...
@@ -156,14 +156,22 @@ def get_user_tag_score(cl_id, all_word_tags, size=10):
user_df_service_sql
=
"select time,cl_id,score_type,tag_id,tag_referrer,action from user_new_tag_log "
\
user_df_service_sql
=
"select time,cl_id,score_type,tag_id,tag_referrer,action from user_new_tag_log "
\
"where cl_id ='{}' and action != 'do_search' "
.
format
(
cl_id
)
"where cl_id ='{}' and action != 'do_search' "
.
format
(
cl_id
)
cur_jerry_test
.
execute
(
user_df_service_sql
)
cur_jerry_test
.
execute
(
user_df_service_sql
)
user_log_df
=
pd
.
DataFrame
(
list
(
cur_jerry_test
.
fetchall
()))
data
=
list
(
cur_jerry_test
.
fetchall
())
user_log_df
.
columns
=
[
"time"
,
"cl_id"
,
"score_type"
,
"tag_id"
,
"tag_referrer"
,
"action"
]
if
data
:
user_log_df
=
pd
.
DataFrame
(
data
)
user_log_df
.
columns
=
[
"time"
,
"cl_id"
,
"score_type"
,
"tag_id"
,
"tag_referrer"
,
"action"
]
else
:
user_log_df
=
pd
.
DataFrame
(
columns
=
[
"time"
,
"cl_id"
,
"score_type"
,
"tag_id"
,
"tag_referrer"
,
"action"
])
# 用户的搜索行为
# 用户的搜索行为
user_df_search_sql
=
"select time,cl_id,score_type,tag_id,tag_referrer,action from user_new_tag_log "
\
user_df_search_sql
=
"select time,cl_id,score_type,tag_id,tag_referrer,action from user_new_tag_log "
\
"where cl_id ='{}' and action = 'do_search'"
.
format
(
cl_id
)
"where cl_id ='{}' and action = 'do_search'"
.
format
(
cl_id
)
cur_jerry_test
.
execute
(
user_df_search_sql
)
cur_jerry_test
.
execute
(
user_df_search_sql
)
user_df_search
=
pd
.
DataFrame
(
list
(
cur_jerry_test
.
fetchall
()))
data_search
=
list
(
cur_jerry_test
.
fetchall
())
user_df_search
.
columns
=
[
"time"
,
"cl_id"
,
"score_type"
,
"tag_id"
,
"tag_referrer"
,
"action"
]
if
data_search
:
user_df_search
=
pd
.
DataFrame
(
data_search
)
user_df_search
.
columns
=
[
"time"
,
"cl_id"
,
"score_type"
,
"tag_id"
,
"tag_referrer"
,
"action"
]
else
:
user_df_search
=
pd
.
DataFrame
(
columns
=
[
"time"
,
"cl_id"
,
"score_type"
,
"tag_id"
,
"tag_referrer"
,
"action"
])
# 搜索词转成tag
# 搜索词转成tag
for
index
,
row
in
user_df_search
.
iterrows
():
for
index
,
row
in
user_df_search
.
iterrows
():
...
...
eda/smart_rank/dist_update_user_portrait_service.py
View file @
035053a0
...
@@ -212,7 +212,7 @@ def get_user_service_portrait(cl_id, all_word_tags, all_tag_tag_type, all_3tag_2
...
@@ -212,7 +212,7 @@ def get_user_service_portrait(cl_id, all_word_tags, all_tag_tag_type, all_3tag_2
cur_jerry_test
.
execute
(
user_df_service_sql
)
cur_jerry_test
.
execute
(
user_df_service_sql
)
data
=
list
(
cur_jerry_test
.
fetchall
())
data
=
list
(
cur_jerry_test
.
fetchall
())
if
data
:
if
data
:
user_df_service
=
pd
.
DataFrame
()
user_df_service
=
pd
.
DataFrame
(
data
)
user_df_service
.
columns
=
[
"time"
,
"cl_id"
,
"score_type"
,
"tag_id"
,
"tag_referrer"
,
"action"
]
user_df_service
.
columns
=
[
"time"
,
"cl_id"
,
"score_type"
,
"tag_id"
,
"tag_referrer"
,
"action"
]
else
:
else
:
user_df_service
=
pd
.
DataFrame
(
columns
=
[
"time"
,
"cl_id"
,
"score_type"
,
"tag_id"
,
"tag_referrer"
,
"action"
])
user_df_service
=
pd
.
DataFrame
(
columns
=
[
"time"
,
"cl_id"
,
"score_type"
,
"tag_id"
,
"tag_referrer"
,
"action"
])
...
@@ -222,7 +222,7 @@ def get_user_service_portrait(cl_id, all_word_tags, all_tag_tag_type, all_3tag_2
...
@@ -222,7 +222,7 @@ def get_user_service_portrait(cl_id, all_word_tags, all_tag_tag_type, all_3tag_2
cur_jerry_test
.
execute
(
user_df_search_sql
)
cur_jerry_test
.
execute
(
user_df_search_sql
)
data_search
=
list
(
cur_jerry_test
.
fetchall
())
data_search
=
list
(
cur_jerry_test
.
fetchall
())
if
data_search
:
if
data_search
:
user_df_search
=
pd
.
DataFrame
()
user_df_search
=
pd
.
DataFrame
(
data_search
)
user_df_search
.
columns
=
[
"time"
,
"cl_id"
,
"score_type"
,
"tag_id"
,
"tag_referrer"
,
"action"
]
user_df_search
.
columns
=
[
"time"
,
"cl_id"
,
"score_type"
,
"tag_id"
,
"tag_referrer"
,
"action"
]
else
:
else
:
user_df_search
=
pd
.
DataFrame
(
columns
=
[
"time"
,
"cl_id"
,
"score_type"
,
"tag_id"
,
"tag_referrer"
,
"action"
])
user_df_search
=
pd
.
DataFrame
(
columns
=
[
"time"
,
"cl_id"
,
"score_type"
,
"tag_id"
,
"tag_referrer"
,
"action"
])
...
...
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