From aa6e9dc592769d5abd29188dc7f8df8eb8360e28 Mon Sep 17 00:00:00 2001 From: poxf2i6c4 <2437587625@qq.com> Date: Mon, 20 Jan 2025 19:24:44 +0800 Subject: [PATCH] ADD file via upload --- README_V2.md | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 README_V2.md diff --git a/README_V2.md b/README_V2.md new file mode 100644 index 0000000..2a4c0b1 --- /dev/null +++ b/README_V2.md @@ -0,0 +1,72 @@ + # 开源项目贡献者流失预测 + +## 项目结构 + ''' +contributor_churn_prediction/ +│ +├── data/ +│ ├── linux_commits.csv +│ └── rust_commits.csv +│ +├── src/ +│ ├── data_preprocessing.py +│ ├── time_series_prediction.py +│ ├── model.py +│ +├── requirements.txt +├── main.py +└── README_V2.md + ''' + + ## 环境配置 + + 1. 安装 Anaconda 或 Miniconda。 + + 2. 创建虚拟环境: + ''' +conda create -n churn_pred python=12 +conda activate churn_pred + ''' + 3. 安装依赖: + ''' +pip install -r requirements.txt + ''' + 4. 安装额外的系统依赖: + ''' +sudo apt-get update +sudo apt-get install -y libpq-dev build-essential + ''' + 5. 配置环境变量: + ''' +export PYTHONPATH="${PYTHONPATH}:/path/to/contributor_churn_prediction" +export DATA_DIR="/path/to/data" +export MODEL_CACHE="/path/to/model_cache" + ''' + 6. 下载并安装自定义的模型包: + ''' +git clone https://github.com/custom_models/churn_pred.git +cd churn_pred +pip install -e . + ''' + ## 运行代码 + + 1. 数据预处理: + ''' + python src/data_preprocessing.py --input $DATA_DIR/linux_commits.csv --output $DATA_DIR/processed_linux.pkl + python src/data_preprocessing.py --input $DATA_DIR/rust_commits.csv --output $DATA_DIR/processed_rust.pkl + ''' + + 2. 特征工程: + ''' +python src/time_series_prediction.py --input $DATA_DIR/processed_linux.pkl --output $DATA_DIR/features_linux.pkl +python src/time_series_prediction.py --input $DATA_DIR/processed_rust.pkl --output $DATA_DIR/features_rust.pkl + ''' + 3. 模型训练: + ''' +python src/model.py --input $DATA_DIR/features_linux.pkl --model-type rf --output $MODEL_CACHE/model_linux.pkl +python src/model.py --input $DATA_DIR/features_rust.pkl --model-type xgb --output $MODEL_CACHE/model_rust.pkl + ''' + 4.预测: + ''' +python main.py --linux-model $MODEL_CACHE/model_linux.pkl --rust-model $MODEL_CACHE/model_rust.pkl --output results.json + '''