From 7d5ebc0421ade15a576c022de49a8049ae8a6bf1 Mon Sep 17 00:00:00 2001 From: jianjun Date: Mon, 31 May 2021 17:08:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AD=A3=E8=B4=9F=E7=9B=B8=E5=85=B3=E4=B8=80?= =?UTF-8?q?=E7=9B=B4=E6=B2=A1=E8=B5=B7=E4=BD=9C=E7=94=A8=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../normalizing/batch/BatchScoreCalculator.java | 14 ++++++++++---- .../epmet/stats/test/normalizing/MathUtilTest.java | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java index 47be178b7a..754e2cf7bc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java @@ -80,13 +80,19 @@ public class BatchScoreCalculator { .multiply( (maxScoreValue.subtract(minScoreValue).divide(new BigDecimal(Math.PI / 2), 10, RoundingMode.HALF_UP))) .add(minScoreValue).setScale(6, RoundingMode.HALF_UP); - // - if (scoreCalculator.getCorrelation().getCode().equals(Correlation.NEGATIVE)) { - normalizeValue = maxScoreValue.subtract(normalizeValue); - } + + } else { normalizeValue = scoreCalculator.normalize(getFinalSampleValue(vo.getSampleValue(), threshold)); } + //如果是负相关 则用100-归一后的值为最大值减 + if (Correlation.NEGATIVE.getCode().equals(scoreCalculator.getCorrelation().getCode())) { + normalizeValue = maxScoreValue.subtract(normalizeValue); + } + } + //如果归一后的值小于0 则置为0 + if (normalizeValue.compareTo(NumConstant.ZERO_DECIMAL)<=-1){ + normalizeValue = NumConstant.ZERO_DECIMAL; } BigDecimal score = normalizeValue.multiply(weight).setScale(6, RoundingMode.HALF_UP); CalculateResult result = scoreCountOfSamples.get(sampleId); diff --git a/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/MathUtilTest.java b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/MathUtilTest.java index 408f837691..9d0178385a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/MathUtilTest.java +++ b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/MathUtilTest.java @@ -5,7 +5,7 @@ import java.math.RoundingMode; public class MathUtilTest { public static void main(String[] args) { - //值 域:(-π/2,π/2) ->(60,100) + //值 域:[-π/2,π/2] ->[60,100] double tan = Math.atan(4); double tan2 = Math.atan(1); double tan3 = Math.atan(8);