测试--模型预测接口测试完成

This commit is contained in:
haotian 2025-02-25 10:25:14 +08:00
parent 382271e424
commit 4d660f9b8c
3 changed files with 28 additions and 5 deletions

View File

@ -14,7 +14,7 @@ class TrainRequest(BaseModel):
algorithm: str
task_type : str
parameters: Dict
metrics: List[str]
# metrics: List[str]
experiment_name: str
class PredictRequest(BaseModel):
@ -60,7 +60,7 @@ async def train_model(request: TrainRequest):
'algorithm': request.algorithm,
'task_type': request.task_type,
'params': request.parameters,
'metrics': request.metrics
# 'metrics': request.metrics
},
experiment_name=request.experiment_name
)

View File

@ -61,19 +61,42 @@ GET http://10.0.0.202:8992/model/available/{model_name}
GET http://10.0.0.202:8992/model/metrics
### 3.10 模型训练
POST
POST http://10.0.0.202:8992/model/train
{
"train_path": "/home/admin-root/haotian/MLPlatform/dataset/dataset_processed/breast_cancer_20250224_170615/train_breast_cancer_20250224_170615.csv",
"val_path": "/home/admin-root/haotian/MLPlatform/dataset/dataset_processed/breast_cancer_20250224_170615/val_breast_cancer_20250224_170615.csv",
"algorithm": "XGBClassifier",
"task_type": "classification",
"parameters": {
"n_estimators": 100,
"learning_rate": 0.1,
"max_depth": 6,
"random_state": 42
},
"experiment_name": "test_post_1"
}
### 3.11 获取实验列表
GET http://10.0.0.202:8992/model/experiments
### 3.12 获取具体实验内容
GET http://10.0.0.202://8992/model/experiment/{experiment_name}
GET http://10.0.0.202:8992/model/experiment/{experiment_name}
### 3.13 删除模型指定实验模型
DELETE
### 3.14 模型预测
POST
POST http://10.0.0.202:8992/model/predict
{
"run_id": "33939ea6d8ce4d43a268f23f7361651e",
"data_path": "/home/admin-root/haotian/MLPlatform/dataset/dataset_processed/breast_cancer_20250219_145614/test_breast_cancer_20250219_145614.csv",
"output_path": "predictions/pred_breast_cancer_20250219_145614.csv",
"return_proba": true,
"metrics": [
"accuracy", "f1", "precision", "recall"
]
}
### 3.15 查看系统资源使用情况
GET http://10.0.0.202:8992/system/resources