We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1942ec4 commit 60d4e42Copy full SHA for 60d4e42
src/main/java/org/panda/causalpath/analyzer/ThresholdDetector.java
@@ -88,6 +88,8 @@ public OneDataChangeDetector makeACopy()
88
*/
89
public double foldChangeGeometricMean(double[] vals)
90
{
91
+ if (vals.length == 1) return vals[0];
92
+
93
double mult = 1;
94
int cnt = 0;
95
for (double val : vals)
@@ -96,7 +98,9 @@ public double foldChangeGeometricMean(double[] vals)
96
98
cnt++;
97
99
mult *= val < 0 ? -1 / val : val;
100
}
- return Math.pow(mult, 1D / cnt);
101
+ double result = Math.pow(mult, 1D / cnt);
102
+ if (result < 1) result = - 1 / result;
103
+ return result;
104
105
106
public double maxOfAbs(double[] vals)
0 commit comments