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
6795dd41
Commit
6795dd41
authored
Nov 15, 2019
by
高雅喆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
65ab6c25
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
19 deletions
+19
-19
tool.py
eda/smart_rank/tool.py
+19
-19
No files found.
eda/smart_rank/tool.py
View file @
6795dd41
...
...
@@ -235,50 +235,50 @@ def get_tag2_from_tag3(tag3, all_3tag_2tag, user_log_df_tag2_list):
print
(
e
)
def
compute_henqiang
(
x
,
decay_days
=
30
,
normalization_size
=
7
,
exponential
=
0
):
def
compute_henqiang
(
x
,
decay_days
=
30
,
exponential
=
0
):
if
exponential
:
alpha
=
exponential_decay
(
x
,
decay_days
,
normalization_size
)
score
=
15
-
2
**
alpha
*
((
15
-
0.5
)
/
decay_days
)
alpha
=
exponential_decay
(
x
,
decay_days
)
score
=
15
-
1.1
**
alpha
*
((
15
-
0.5
)
/
decay_days
)
else
:
score
=
15
-
x
*
((
15
-
0.5
)
/
decay_days
)
if
score
>
0.5
:
return
score
else
:
return
0.5
def
compute_jiaoqiang
(
x
,
decay_days
=
30
,
normalization_size
=
7
,
exponential
=
0
):
def
compute_jiaoqiang
(
x
,
decay_days
=
30
,
exponential
=
0
):
if
exponential
:
alpha
=
exponential_decay
(
x
,
decay_days
,
normalization_size
)
score
=
12
-
2
**
alpha
*
((
12
-
0.5
)
/
decay_days
)
alpha
=
exponential_decay
(
x
,
decay_days
)
score
=
12
-
1.1
**
alpha
*
((
12
-
0.5
)
/
decay_days
)
else
:
score
=
12
-
x
*
((
12
-
0.5
)
/
decay_days
)
if
score
>
0.5
:
return
score
else
:
return
0.5
def
compute_ruoyixiang
(
x
,
decay_days
=
30
,
normalization_size
=
7
,
exponential
=
0
):
def
compute_ruoyixiang
(
x
,
decay_days
=
30
,
exponential
=
0
):
if
exponential
:
alpha
=
exponential_decay
(
x
,
decay_days
,
normalization_size
)
score
=
5
-
2
**
alpha
*
((
5
-
0.5
)
/
decay_days
)
alpha
=
exponential_decay
(
x
,
decay_days
)
score
=
5
-
1.1
**
alpha
*
((
5
-
0.5
)
/
decay_days
)
else
:
score
=
5
-
x
*
((
5
-
0.5
)
/
decay_days
)
if
score
>
0.5
:
return
score
else
:
return
0.5
def
compute_validate
(
x
,
decay_days
=
30
,
normalization_size
=
7
,
exponential
=
0
):
def
compute_validate
(
x
,
decay_days
=
30
,
exponential
=
0
):
if
exponential
:
alpha
=
exponential_decay
(
x
,
decay_days
,
normalization_size
)
score
=
10
-
2
**
alpha
*
((
10
-
0.5
)
/
decay_days
)
alpha
=
exponential_decay
(
x
,
decay_days
)
score
=
10
-
1.1
**
alpha
*
((
10
-
0.5
)
/
decay_days
)
else
:
score
=
10
-
x
*
((
10
-
0.5
)
/
decay_days
)
if
score
>
0.5
:
return
score
else
:
return
0.5
def
compute_ai_scan
(
x
,
decay_days
=
30
,
normalization_size
=
7
,
exponential
=
0
):
def
compute_ai_scan
(
x
,
decay_days
=
30
,
exponential
=
0
):
if
exponential
:
alpha
=
exponential_decay
(
x
,
decay_days
,
normalization_size
)
score
=
2
-
2
**
alpha
*
((
2
-
0.5
)
/
decay_days
)
alpha
=
exponential_decay
(
x
,
decay_days
)
score
=
2
-
1.1
**
alpha
*
((
2
-
0.5
)
/
decay_days
)
else
:
score
=
2
-
x
*
((
2
-
0.5
)
/
decay_days
)
if
score
>
0.5
:
...
...
@@ -295,10 +295,10 @@ def get_action_tag_count(df, action_time):
print
(
e
)
def
exponential_decay
(
days_diff
,
decay_days
=
30
,
normalization_size
=
7
):
x
=
np
.
arange
(
1
,
decay_days
+
1
,
1
)
# 天数差归一化到[0, normalization_size]
a
=
(
normalization_size
-
0
)
*
(
days_diff
-
min
(
x
))
/
(
max
(
x
)
-
min
(
x
))
def
exponential_decay
(
days_diff
,
decay_days
=
30
):
# 天数差归一化到[0, decay_days]
x
=
np
.
arange
(
1
,
180
+
1
,
1
)
a
=
(
decay_days
-
0
)
*
(
days_diff
-
min
(
x
))
/
(
max
(
x
)
-
min
(
x
))
return
a
...
...
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