# intelligent_modeling **Repository Path**: For---ever/intelligent_modeling ## Basic Information - **Project Name**: intelligent_modeling - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-07-03 - **Last Updated**: 2026-07-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 智能房价评估系统 基于机器学习的智能房价评估Web应用,集成6种核心算法,支持数据上传、预处理、算法训练、参数调优、模型预测、结果可视化与历史记录管理。 ## 技术栈 | 层级 | 技术 | |------|------| | 前端 | HTML5, CSS3, JavaScript ES6+, Bootstrap 5, Axios, ECharts | | 后端 | Python 3.9+, Flask, Flask-SQLAlchemy, PyJWT, flasgger, joblib | | 算法 | scikit-learn, Pandas, NumPy | | 数据库 | MySQL 8.0+ | | 部署 | Gunicorn + Nginx, Ubuntu 20.04/22.04 | ## 核心功能 - 用户注册/登录(JWT无状态认证,自动创建6个示范数据集) - 数据集上传与自动预处理(缺失值填充、异常值处理、Z-score标准化、Label Encoding) - 6种机器学习算法:线性回归、逻辑回归、K-means聚类、决策树、朴素贝叶斯、随机森林 - 算法参数调优(GridSearchCV网格搜索,调优前后量化对比) - 多算法横向对比分析 - 性能基准测试(训练/加载/查询/预处理耗时) - 模型预测(上传新数据或使用已有数据集,支持示范数据集自动匹配) - 结果可视化(散点图、混淆矩阵、雷达图、柱状图、肘部法等ECharts图表) - 预测历史记录查询与管理 - 用户数据隔离,全链路数据可追溯 - 模型保存/加载(joblib) ## 快速开始 ### 1. 环境准备 ```bash # 克隆项目 git clone cd intelligent_modeling # 创建虚拟环境 python -m venv venv source venv/bin/activate # Linux/Mac # venv\Scripts\activate # Windows # 安装依赖 pip install -r backend/requirements.txt ``` ### 2. 数据库配置 ```bash # 登录MySQL,创建数据库 mysql -u root -p CREATE DATABASE intelligent_modeling CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; # 执行建表脚本 mysql -u root -p intelligent_modeling < docs/database/init.sql ``` ### 3. 配置环境变量 ```bash cp backend/.env.example backend/.env # 编辑 backend/.env,填入数据库密码和JWT密钥 ``` ### 4. 启动后端 ```bash cd backend python run.py # 默认运行在 http://localhost:5000 ``` ### 5. 启动前端 ```bash # 使用任意静态文件服务器 cd frontend python -m http.server 8080 # 访问 http://localhost:8080 ``` ### 6. 访问应用 - 前端页面: http://localhost:8080 - 后端API: http://localhost:5000/api/v1 - Swagger文档: http://localhost:5000/apidocs ## 项目结构 ``` intelligent_modeling/ ├── frontend/ # 纯静态前端 │ ├── css/style.css # 自定义样式 │ ├── js/ │ │ ├── config.js # 全局配置,API地址集中管理 │ │ ├── api.js # Axios封装,JWT拦截器 │ │ └── charts.js # ECharts图表工具模块 │ ├── pages/ │ │ ├── login.html # 登录页 │ │ ├── register.html # 注册页 │ │ ├── dashboard.html # 控制台/概览 │ │ ├── datasets.html # 数据集管理 │ │ ├── algorithms.html # 算法训练与对比 │ │ ├── results.html # 训练结果与指标 │ │ ├── prediction.html # 模型预测 │ │ ├── predictions.html # 预测历史记录 │ │ ├── history.html # 历史记录 │ │ └── guide.html # 用户指南 │ └── index.html # 入口页面 │ ├── backend/ │ ├── app/ │ │ ├── api/ │ │ │ ├── auth.py # 认证:注册、登录、用户信息 │ │ │ ├── data.py # 数据:上传、列表、详情、删除 │ │ │ ├── algorithms.py # 算法:训练、调优、对比、基准测试、预测 │ │ │ ├── results.py # 结果:列表、详情、对比 │ │ │ └── predictions.py # 预测记录:列表、详情、删除 │ │ ├── models/ │ │ │ ├── user.py # 用户模型 │ │ │ ├── dataset.py # 数据集模型 │ │ │ ├── algorithm_task.py # 算法任务模型 │ │ │ ├── result.py # 结果模型 │ │ │ └── prediction_record.py # 预测记录模型 │ │ ├── services/ # 6种ML算法 + 调优 + 基准测试逻辑 │ │ ├── config.py # 配置(dev/prod/test) │ │ ├── extensions.py # SQLAlchemy, CORS初始化 │ │ └── errors.py # 全局异常处理,统一响应格式 │ ├── scripts/ # 数据生成脚本 │ ├── test_data/ # 内置训练数据集(CSV) │ ├── predict_data/ # 内置预测数据集(CSV) │ ├── uploads/ # 用户上传数据 │ ├── .env.example # 环境变量模板 │ ├── requirements.txt # Python依赖 │ └── run.py # 启动入口 │ ├── deploy/ # 部署配置 │ ├── deploy.sh # 一键部署脚本 │ ├── nginx.conf # Nginx反向代理配置 │ ├── gunicorn.conf.py # Gunicorn WSGI配置 │ └── intelligent_modeling.service # systemd服务文件 │ ├── docs/ # 文档 │ ├── api_documentation.md # API接口文档 │ ├── data_guide.md # 数据上传指南 │ ├── deploy_guide.md # 部署文档 │ ├── test_report.md # 测试报告 │ ├── presentation.md # 汇报PPT(Marp源码) │ ├── presentation.pptx # 汇报PPT │ ├── 智能房价评估开发项目.docx # 项目报告 │ └── database/ │ ├── init.sql # 建表脚本 │ └── backup.sql # 数据库备份 │ ├── .gitignore └── README.md ``` ## API接口 所有接口统一前缀 `/api/v1`,返回格式: ```json { "code": 200, "msg": "success", "data": {} } ``` 共 **22个API接口**,分布在5个模块: | 模块 | 接口数 | 功能 | |------|--------|------| | 认证 `/auth` | 4 | 注册、登录、获取/更新用户信息 | | 数据 `/data` | 4 | 上传、列表、详情、删除 | | 算法 `/algorithms` | 11 | 列表、参数、训练、调优、基准测试、预测、对比、任务管理 | | 结果 `/results` | 3 | 列表、详情、对比 | | 预测记录 `/predictions` | 3 | 列表、详情、删除 | 详细接口文档请访问 `/apidocs` (Swagger UI) 或查阅 [API文档](docs/api_documentation.md)。 ## 算法支持 | 算法 | 类型 | 评估指标 | |------|------|---------| | 线性回归 | 回归 | R², MAE, MSE | | 逻辑回归 | 分类 | 准确率, 精确率, 召回率, F1, 混淆矩阵 | | K-means聚类 | 聚类 | 轮廓系数, SSE, 聚类中心 | | 决策树 | 分类 | 准确率, F1, 特征重要性 | | 朴素贝叶斯 | 分类 | 准确率, F1 | | 随机森林 | 分类 | 准确率, F1, 特征重要性 | ## 部署 详见 [部署文档](docs/deploy_guide.md)。 ## 文档 - [API接口文档](docs/api_documentation.md) - [数据上传指南](docs/data_guide.md) - [测试报告](docs/test_report.md) - [汇报PPT](docs/presentation.pptx) - [项目报告](docs/智能房价评估开发项目.docx) ## 许可证 本项目仅用于学习交流。