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
971bb156
Commit
971bb156
authored
5 years ago
by
赵威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get user log
parent
3b624793
master
mr/beta/bug22
offic
rtt
zhao22
1 merge request
!43
Offic
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
8 deletions
+33
-8
tag3_update_user_portrait_offline.py
eda/smart_rank/tag3_update_user_portrait_offline.py
+7
-0
tool.py
eda/smart_rank/tool.py
+26
-8
No files found.
eda/smart_rank/tag3_update_user_portrait_offline.py
View file @
971bb156
from
tool
import
get_tag3_user_log
def
update_tag3_user_portrait
(
cl_id
):
user_df
=
get_tag3_user_log
(
cl_id
)
if
not
user_df
.
empty
:
pass
if
__name__
==
"__main__"
:
cl_id
=
"866017030837899"
a
=
get_tag3_user_log
(
cl_id
)
...
...
This diff is collapsed.
Click to expand it.
eda/smart_rank/tool.py
View file @
971bb156
...
...
@@ -365,20 +365,38 @@ def get_jerry_test_cursor():
return
db
.
cursor
()
def
compute_tag3_score
(
x
):
if
x
.
score_type
==
"henqiang"
:
return
compute_henqiang
(
x
.
days_diff_now
,
exponential
=
1
)
elif
x
.
score_type
==
"jiaoqiang"
:
return
compute_jiaoqiang
(
x
.
days_diff_now
,
exponential
=
1
)
elif
x
.
score_type
==
"ai_scan"
:
return
compute_ai_scan
(
x
.
days_diff_now
,
exponential
=
1
)
elif
x
.
score_type
==
"ruoyixiang"
:
return
compute_ruoyixiang
(
x
.
days_diff_now
,
exponential
=
1
)
else
:
return
compute_validate
(
x
.
days_diff_now
,
exponential
=
1
)
def
get_tag3_user_log
(
cl_id
):
columns
=
[
"log_time"
,
"cl_id"
,
"tag_referrer"
,
"score_type"
,
"action"
,
"event"
,
"event_cn"
,
"first_solutions"
,
"second_solutions"
,
"first_demands"
,
"second_demands"
,
"first_positions"
,
"second_positions"
,
"projects"
,
"card_type"
"log_time"
,
"score_type"
,
"event_cn"
,
"first_solutions"
,
"second_solutions"
,
"first_demands"
,
"second_demands"
,
"first_positions"
,
"second_positions"
,
"projects"
]
sql
=
"""select log_time,
cl_id, tag_referrer, score_type, action, event, event_cn, first_solution
s,
second_solutions, first_demands, second_demands, first_positions, second_positions,
projects, card_type
from kafka_tag3_log where cl_id = '{}'"""
.
format
(
cl_id
)
sql
=
"""select log_time,
score_type, event_cn, first_solutions, second_solutions, first_demand
s,
second_demands, first_positions, second_positions, projects
from kafka_tag3_log where cl_id = '{}'"""
.
format
(
cl_id
)
cursor
=
get_jerry_test_cursor
()
cursor
.
execute
(
sql
)
data
=
list
(
cursor
.
fetchall
())
user_df
=
pd
.
DataFrame
(
data
)
user_df
.
columns
=
columns
if
data
:
user_df
=
pd
.
DataFrame
(
data
)
user_df
.
columns
=
columns
else
:
return
pd
.
DataFrame
(
columns
=
columns
)
user_df
[
"days_diff_now"
]
=
round
((
int
(
time
.
time
())
-
user_df
[
"log_time"
]
.
astype
(
float
))
/
(
24
*
60
*
60
))
user_df
[
"tag_score"
]
=
user_df
.
apply
(
lambda
x
:
compute_tag3_score
(
x
),
axis
=
1
)
return
user_df
This diff is collapsed.
Click to expand it.
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