package ${pkgName}.impl; import ${pkgName}.${pyName}; import utils.AlgsUtils; import java.util.HashMap; public class ${pyName}Impl extends ${pyName} { private AlgsUtils utils = new AlgsUtils(); //train的输出map private HashMap train_result; //predict输入模型 private HashMap model; //predict输出模型 private HashMap predict_result; public native HashMap ${pyName}Train(double[][] dataone, HashMap settings); @Override public HashMap train(double[][] dataone, HashMap settings) { double startTime = System.currentTimeMillis(); //获取开始时间 if (dataone == null || dataone.length == 0 || dataone[0].length == 0) { train_result = new HashMap(); train_result.put("status_code", -4); return train_result; } train_result = ${pyName}Train(dataone, settings); return train_result; } public native HashMap ${pyName}Predict(#foreach ($column in [1..$dataLength])double data${column}[][], #{end}HashMap models, HashMap settings); @Override public HashMap predict(#foreach ($column in [1..$dataLength])double data${column}[][], #{end}HashMap models, HashMap settings) { model = utils.createPredictHashmapplus(models); if (#{foreach} ($column in [1..$dataLength])#{if}($column==1)data${column} == null || data${column}.length == 0 || data${column}[0].length == 0#{else} || data${column} == null || data${column}.length == 0 || data${column}[0].length == 0#{end}#{end}) { predict_result = new HashMap(); predict_result.put("status_code", -4); return predict_result; } predict_result = ${pyName}Predict(#foreach ($column in [1..$dataLength])data${column}, #{end}model, settings); // predict_result.put("result_code",utils.reverseResultCode(predict_result)); return predict_result; } }