|
|
|
@ -241,7 +241,7 @@ public class StuDigitalMarketingModelController {
|
|
|
|
|
LogisticRegression lr = new LogisticRegression(x, y);
|
|
|
|
|
double[] coefficients = lr.fit();
|
|
|
|
|
|
|
|
|
|
DecimalFormat df = new DecimalFormat("#.0");
|
|
|
|
|
DecimalFormat df = new DecimalFormat("#.00");
|
|
|
|
|
RAnalysisDTO rAnalysisDTO=new RAnalysisDTO();
|
|
|
|
|
|
|
|
|
|
rAnalysisDTO.setIntercept(Double.parseDouble(df.format(coefficients[0])));
|
|
|
|
@ -250,6 +250,21 @@ public class StuDigitalMarketingModelController {
|
|
|
|
|
return new ResultEntity(HttpStatus.OK,"成功",rAnalysisDTO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ApiOperation("回归分析--走势图")
|
|
|
|
|
@PostMapping("/trendChart")
|
|
|
|
|
@AnonymousAccess
|
|
|
|
|
public ResultEntity trendChart(@RequestBody LogisticDTO logisticDTO) {
|
|
|
|
|
double[] x = logisticDTO.getX();
|
|
|
|
|
double[] y = logisticDTO.getY();
|
|
|
|
|
|
|
|
|
|
LogisticRegression lr = new LogisticRegression(x, y);
|
|
|
|
|
double[][] coefficients = lr.getCoordinatesOnLine();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new ResultEntity(HttpStatus.OK,"成功",coefficients);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("线性回归/逻辑回归--预测")
|
|
|
|
|
@PostMapping("/prediction")
|
|
|
|
|