From 0657ed6b00c45fdda2a1bfb3fa9561eb1c15fbcd Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Sun, 19 Jun 2022 21:22:07 -0400 Subject: [PATCH] fix: aggregation bug --- packages/utility-tools/src/aggregatePaths.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/utility-tools/src/aggregatePaths.js b/packages/utility-tools/src/aggregatePaths.js index eac9425..4307259 100644 --- a/packages/utility-tools/src/aggregatePaths.js +++ b/packages/utility-tools/src/aggregatePaths.js @@ -112,19 +112,19 @@ export function aggregatePathsThroughMixtureOfMeans({ let hasNegative = expectedRelativeValuesFiltered.filter((x) => x < 0); let answer; if (hasPositive.length != 0 && hasNegative.length != 0) { - answer = avg(expectedRelativeValues); + answer = avg(expectedRelativeValuesFiltered); } else { if (hasNegative.length == 0) { - answer = geomMean(expectedRelativeValues); + answer = geomMean(expectedRelativeValuesFiltered); } else { - let arrayAsPositive = expectedRelativeValues.map((x) => -x); + let arrayAsPositive = expectedRelativeValuesFiltered.map((x) => -x); answer = -geomMean(arrayAsPositive); } } return { name: orderedList[i].name, aggregatedMeans: answer, - arrayMeans: expectedRelativeValues, + arrayMeans: expectedRelativeValuesFiltered, allPositive: hasNegative.length == 0, }; });