# 推荐系统离线任务 - 常用命令 ## 安装和测试 cd /home/tw/recommendation/offline_tasks bash install.sh python3 test_connection.py ## 运行所有任务 python3 run_all.py --lookback_days 730 --top_n 50 ## 运行单个任务 python3 scripts/i2i_swing.py --lookback_days 730 --top_n 50 --time_decay python3 scripts/i2i_session_w2v.py --lookback_days 730 --top_n 50 --save_model python3 scripts/i2i_deepwalk.py --lookback_days 730 --top_n 50 --save_model --save_graph python3 scripts/interest_aggregation.py --lookback_days 730 --top_n 1000 ## 加载到Redis python3 scripts/load_index_to_redis.py --redis-host localhost --redis-port 6379 --expire-days 7 ## 查询示例 python3 example_query_redis.py ## 查看日志 tail -f logs/run_all_*.log ## 查看输出 ls -lh output/ head -n 5 output/i2i_swing_*.txt head -n 5 output/interest_aggregation_hot_*.txt ## 定时任务设置 crontab -e # 添加: # 0 2 * * * cd /home/tw/recommendation/offline_tasks && /usr/bin/python3 run_all.py >> logs/cron.log 2>&1 # 0 6 * * * cd /home/tw/recommendation/offline_tasks && /usr/bin/python3 scripts/load_index_to_redis.py >> logs/load_redis.log 2>&1