Commit e32a9664 authored by 高雅喆's avatar 高雅喆

用户画像分层影响

parent 3751c44d
This diff is collapsed.
......@@ -76,6 +76,12 @@ def compute_validate(x):
return score
else:
return 0.5
def compute_ai_scan(x):
score = 2 - x * ((2 - 0.5) / 180)
if score>0.5:
return score
else:
return 0.5
def tag_list2dict(lst, size):
result = []
if lst:
......@@ -104,7 +110,8 @@ def get_user_tag_score(cl_id, all_log_df, size=10):
user_log_df["tag_score"] = user_log_df.apply(
lambda x: compute_henqiang(x.days_diff_now) if x.score_type == "henqiang" else (
compute_jiaoqiang(x.days_diff_now) if x.score_type == "jiaoqiang" else (
compute_ruoyixiang(x.days_diff_now) if x.score_type == "ruoyixiang" else compute_validate(x.days_diff_now))), axis=1)
compute_ai_scan(x.days_diff_now) if x.score_type == "ai_scan" else (
compute_ruoyixiang(x.days_diff_now) if x.score_type == "ruoyixiang" else compute_validate(x.days_diff_now)))), axis=1)
finally_score = user_log_df.sort_values(by=["tag_score","time"],ascending=False)
finally_score.drop_duplicates(subset="tag_id", inplace=True)
finally_score_lst = finally_score[["tag_id","tag_score"]].to_dict('record')
......
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