Aucune description

刘立冬 4c96e27635 use long-retention play and share sources il y a 13 heures
fixtures 4c96e27635 use long-retention play and share sources il y a 13 heures
samples efc03a5f33 add reusable risk user feature pipeline il y a 19 heures
scripts efc03a5f33 add reusable risk user feature pipeline il y a 19 heures
sql 4c96e27635 use long-retention play and share sources il y a 13 heures
src 4c96e27635 use long-retention play and share sources il y a 13 heures
tests 4c96e27635 use long-retention play and share sources il y a 13 heures
.gitignore efc03a5f33 add reusable risk user feature pipeline il y a 19 heures
README.md 4c96e27635 use long-retention play and share sources il y a 13 heures
findings.md efc03a5f33 add reusable risk user feature pipeline il y a 19 heures
progress.md efc03a5f33 add reusable risk user feature pipeline il y a 19 heures
requirements.txt efc03a5f33 add reusable risk user feature pipeline il y a 19 heures
task_plan.md efc03a5f33 add reusable risk user feature pipeline il y a 19 heures

README.md

风险用户历史特征查询

本工程保存三类可复用查询及聚合代码:

  1. 用户自身历史行为特征。
  2. 分享关系与来源群特征。
  3. 可选的DAU安全分分档、产品裂变影响与商业化影响评估。

默认回溯锚点前180个自然日,不包含锚点当天。本次220人样本保存在 samples/v2_220_20260810.csv

输入格式

最小字段为mid,anchor_dt。可选字段为user_type,sub_category,也可直接使用 中文列名。若未提供窗口,自动生成anchor_dt-180天anchor_dt-1天

python3 scripts/prepare_input.py \
  --user 'weixin_openid_xxx:20260810:待分析:临时排查' \
  --output samples/ad_hoc.csv

执行

完整执行:

python3 scripts/run_pipeline.py \
  --input samples/ad_hoc.csv \
  --run-name ad_hoc_20260810

仅生成SQL:

python3 scripts/run_pipeline.py \
  --input samples/ad_hoc.csv \
  --run-name ad_hoc_20260810 \
  --sql-only

独立执行基础特征或社交扩展时,分别使用run_behavior_features.pyrun_social_features.py。ODPS执行会输出Instance ID和LogView,并将生成SQL、原始结果、 运行记录及最终报表保存在sql/<run-name>/output/<run-name>/

DAU与商业化影响评估独立执行,不依赖指定用户样本:

python3 scripts/run_impact_report.py \
  --bizdate 20260812 \
  --lookback-days 180 \
  --active-weight 0.5 \
  --run-name impact_20260812_w05

该任务按统计日DAU人数计算安全分分位点,并输出各档的分享、同日回流、无广告曝光、 广告点击和广告转化指标。历史窗口不包含统计日。

DataWorks单用户SQL

不使用Python脚本时,可直接把sql/dataworks_single_user_180d_all_in_one.sql复制到 DataWorks ODPS SQL节点,并配置midanchor_dtwindow_start_dtwindow_end_dt四个节点参数。SQL合并全部6类基础行为特征,最终输出一名用户一行。 180天是请求窗口,实际覆盖还受源表分区保留期限制;交付或解释结果时应先检查 ods_video_play_log_dayuser_share_logvideo_action_log_appletsimpleevent_log的最早可用分区。有效播放使用ods_video_play_log_dayvideoRealPlay,分享使用user_share_log.topic='share'。 2026-08-14的完整检查结果保存在fixtures/source_table_retention_20260814.csv

口径边界

  • 来源群访问UV和有效播放UV在用户级按群求和,跨群用户可能重复。
  • 群有效播放是群访问用户在相同用户统计窗口内产生的全部videoRealPlay,不限定同会话。
  • 分享关系使用点击记录的shareid匹配时间上最近且不晚于点击的分享记录。
  • 项目不保存ODPS或飞书凭据。