From a6e46fe2b5729e7468b6f3c4e079232801c22520 Mon Sep 17 00:00:00 2001 From: dengzedong <dengzedong@email> Date: 星期一, 16 十二月 2024 18:19:37 +0800 Subject: [PATCH] 模型输出类型添加double类型 --- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictModelHandlerImpl.java | 24 +++++++++++++++--------- 1 files changed, 15 insertions(+), 9 deletions(-) diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictModelHandlerImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictModelHandlerImpl.java index e8a9142..a15f603 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictModelHandlerImpl.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictModelHandlerImpl.java @@ -86,13 +86,13 @@ param2Values[portLength] = newModelBean.getDataMap().get("models"); param2Values[portLength + 1] = settings; - log.info("#######################预测模型 " + predictModel.getItemid() + " ##########################"); - JSONObject jsonObjNewModelBean = new JSONObject(); - jsonObjNewModelBean.put("newModelBean", newModelBean); - log.info(String.valueOf(jsonObjNewModelBean)); - JSONObject jsonObjParam2Values = new JSONObject(); - jsonObjParam2Values.put("param2Values", param2Values); - log.info(String.valueOf(jsonObjParam2Values)); + log.info("####################### 预测模型 "+ "【itemId:" + predictModel.getItemid() + ",modelName" + predictModel.getMethodname() + "】 ##########################"); +// JSONObject jsonObjNewModelBean = new JSONObject(); +// jsonObjNewModelBean.put("newModelBean", newModelBean); +// log.info(String.valueOf(jsonObjNewModelBean)); +// JSONObject jsonObjParam2Values = new JSONObject(); +// jsonObjParam2Values.put("param2Values", param2Values); +// log.info(String.valueOf(jsonObjParam2Values)); //IAILMDK.run HashMap<String, Object> modelResult = DllUtils.run(newModelBean, param2Values, predictModel.getMpkprojectid()); @@ -102,13 +102,14 @@ } modelResult = (HashMap<String, Object>) modelResult.get(CommonConstant.MDK_RESULT); //打印结果 - log.info("预测模型计算完成:modelId=" + modelId + modelResult); + log.info("预测模型计算完成:modelId=" + modelId + ",modelName" + predictModel.getMethodname()); JSONObject jsonObjResult = new JSONObject(); jsonObjResult.put("result", modelResult); log.info(String.valueOf(jsonObjResult)); List<MmItemOutputEntity> itemOutputList = mmItemOutputService.getByItemid(predictModel.getItemid()); - Map<MmItemOutputEntity, double[]> predictMatrixs = new HashMap<>(itemOutputList.size()); + Map<MmItemOutputEntity, double[]> predictMatrixs = new HashMap<>(); + Map<MmItemOutputEntity, Double> predictDoubleValues = new HashMap<>(); for (MmItemOutputEntity output : itemOutputList) { if (!modelResult.containsKey(output.getResultstr())) { continue; @@ -127,11 +128,16 @@ } predictMatrixs.put(output, tempColumn); break; + case D: + Double temp3 = (Double) modelResult.get(output.getResultstr()); + predictDoubleValues.put(output, temp3); + break; default: break; } } result.setPredictMatrixs(predictMatrixs); + result.setPredictDoubleValues(predictDoubleValues); result.setModelResult(modelResult); result.setPredictTime(predictTime); } catch (Exception ex) { -- Gitblit v1.9.3