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
a892d9e7
Commit
a892d9e7
authored
5 years ago
by
高雅喆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加分数指数衰减的函数
parent
04f0591c
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
15 deletions
+42
-15
evaluation_metrics.py
eda/smart_rank/evaluation_metrics.py
+0
-0
tool.py
eda/smart_rank/tool.py
+42
-15
No files found.
eda/smart_rank/evaluation_metrics.py
View file @
a892d9e7
This diff is collapsed.
Click to expand it.
eda/smart_rank/tool.py
View file @
a892d9e7
...
...
@@ -174,33 +174,53 @@ def get_tag2_from_tag3(tag3, all_3tag_2tag, user_log_df_tag2_list):
print
(
e
)
def
compute_henqiang
(
x
):
score
=
15
-
x
*
((
15
-
0.5
)
/
180
)
if
score
>
0.5
:
def
compute_henqiang
(
x
,
decay_days
=
180
,
normalization_size
=
7
,
exponential
=
1
):
if
exponential
:
alpha
=
exponential_decay
(
x
,
decay_days
,
normalization_size
)
score
=
15
-
2
**
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
):
score
=
12
-
x
*
(
12
/
180
)
if
score
>
0.5
:
def
compute_jiaoqiang
(
x
,
decay_days
=
180
,
normalization_size
=
7
,
exponential
=
1
):
if
exponential
:
alpha
=
exponential_decay
(
x
,
decay_days
,
normalization_size
)
score
=
12
-
2
**
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
):
score
=
5
-
x
*
((
5
-
0.5
)
/
180
)
if
score
>
0.5
:
def
compute_ruoyixiang
(
x
,
decay_days
=
180
,
normalization_size
=
7
,
exponential
=
1
):
if
exponential
:
alpha
=
exponential_decay
(
x
,
decay_days
,
normalization_size
)
score
=
5
-
2
**
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
):
score
=
10
-
x
*
((
10
-
0.5
)
/
180
)
if
score
>
0.5
:
def
compute_validate
(
x
,
decay_days
=
180
,
normalization_size
=
7
,
exponential
=
1
):
if
exponential
:
alpha
=
exponential_decay
(
x
,
decay_days
,
normalization_size
)
score
=
10
-
2
**
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
):
score
=
2
-
x
*
((
2
-
0.5
)
/
180
)
if
score
>
0.5
:
def
compute_ai_scan
(
x
,
decay_days
=
180
,
normalization_size
=
7
,
exponential
=
1
):
if
exponential
:
alpha
=
exponential_decay
(
x
,
decay_days
,
normalization_size
)
score
=
2
-
2
**
alpha
*
((
2
-
0.5
)
/
decay_days
)
else
:
score
=
2
-
x
*
((
2
-
0.5
)
/
decay_days
)
if
score
>
0.5
:
return
score
else
:
return
0.5
...
...
@@ -212,3 +232,10 @@ def get_action_tag_count(df, action_time):
return
1
except
Exception
as
e
:
print
(
e
)
def
exponential_decay
(
days_diff
,
decay_days
=
180
,
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
))
return
a
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