Commit 6795dd41 authored by 高雅喆's avatar 高雅喆

update

parent 65ab6c25
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment