CostPrediction/README.md

95 lines
2.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 装备成本预测系统
基于机器学习的装备成本预测系统,支持火箭炮和巡飞弹两种装备类型的成本预测与数据分析。
## 功能特性
- 多模型成本预测 (XGBoost, LightGBM, RandomForest, GBM, PyTorch NN, PLS)
- 特征分析与数据可视化
- 算法对比演示
- 生产商分析
- 数据集管理
- 模型训练与评估
## 技术栈
- 后端Python 3.9 ~ 3.11 + Flask
- 数据库SQLite内置零配置
- 前端Vue 3 + Element Plus + ECharts
- 机器学习scikit-learn, XGBoost, LightGBMPyTorch 可选)
## 快速开始
```bash
# 1. 安装依赖
pip install -e .
# 2. 初始化派生特征数据(首次必须执行)
python -m scripts.calculate_features
# 3. 启动服务
python run.py
```
浏览器打开 **http://127.0.0.1:5001**
## 常用命令
```bash
# 安装开发依赖(含 pytest, black, mypy
pip install -e ".[dev]"
# 安装可选 PyTorch神经网络训练需要
pip install -e ".[torch]"
# 运行测试
python -m pytest tests/
# 代码格式化
black src/ tests/
```
## API 文档
### 预测接口
- POST `/api/predict` - 使用最优模型预测
- POST `/api/pls/predict` - 使用 PLS 模型预测
### 数据管理
- GET `/api/data` - 获取装备数据列表
- POST `/api/data/import` - 导入 Excel 数据
- GET `/api/data/details/<id>` - 获取装备详情
- PUT `/api/data/<id>` - 更新装备数据
### 数据集管理
- GET `/api/datasets` - 获取数据集列表
- POST `/api/datasets` - 创建数据集
- DELETE `/api/datasets/<id>` - 删除数据集
### 模型管理
- GET `/api/models` - 获取模型列表
- POST `/api/train` - 训练模型
- POST `/api/models/<id>/activate` - 激活模型
- DELETE `/api/models/<id>` - 删除模型
### 分析功能
- POST `/api/analyze-features` - 特征分析
- POST `/api/analyze-manufacturers` - 生产商分析
- POST `/api/demo/algorithms` - 查看可用算法
- POST `/api/demo/run` - 运行算法演示
## 前端开发
如需修改前端代码:
```bash
cd frontend
npm install
npm run serve # 开发模式(热更新)
npm run build # 构建生产版本
```
## 许可证
本项目采用 [LICENSE](LICENSE) 许可证。