|
|
@ -28,10 +28,7 @@ import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.util.StringUtils; |
|
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Objects; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@ -119,6 +116,7 @@ public class ModelServiceImpl implements ModelService { |
|
|
|
info.setName(model.getModelName()); |
|
|
|
info.setDescription(model.getDescription()); |
|
|
|
info.setRate(model.getRate()); |
|
|
|
info.setTrainTime(new ArrayList<>()); |
|
|
|
modelCfg.setModelInfo(JsonUtils.toJsonString(info)); |
|
|
|
modelCfgService.updateById(modelCfg); |
|
|
|
return modelId; |
|
|
@ -143,14 +141,14 @@ public class ModelServiceImpl implements ModelService { |
|
|
|
|
|
|
|
@Override |
|
|
|
public TrainInfo trainModel(TrainParam param) { |
|
|
|
String trainBody = HttpUtils.post(algorithmHost + "/api/get_smote_data", null, JsonUtils.toJsonString(param)); |
|
|
|
String trainBody = HttpUtils.post(algorithmHost + "/api/test/ClearTrain", null, JsonUtils.toJsonString(param)); |
|
|
|
if (trainBody.contains("error_msg")) { |
|
|
|
throw new RuntimeException("模型训练异常:" + JsonUtils.parseObject(trainBody, |
|
|
|
new TypeReference<Map<String, String>>() { |
|
|
|
}).get("error_msg")); |
|
|
|
} |
|
|
|
return JsonUtils.parseObject(trainBody, new TypeReference<List<TrainInfo>>() { |
|
|
|
}).get(0); |
|
|
|
return JsonUtils.parseObject(trainBody, new TypeReference<TrainInfo>() { |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|