Skip to content

Commit a65b4a6

Browse files
committed
Use sample SD formula
1 parent 16da521 commit a65b4a6

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/DifferentialExpressionPlugin.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,7 @@ void DifferentialExpressionPlugin::computeDE()
650650
return vec[vec.size() / 2];
651651
};
652652

653+
// sample standard deviation
653654
auto computeSD = [](const std::vector<float>& vec, float mean) -> float {
654655
if (vec.size() < 2)
655656
return 0.0f;
@@ -660,7 +661,7 @@ void DifferentialExpressionPlugin::computeDE()
660661
const float diff = val - mean;
661662
sum += diff * diff;
662663
}
663-
return std::sqrt(sum / static_cast<float>(vec.size()));
664+
return std::sqrt(sum / (static_cast<float>(vec.size()) - 1.0f));
664665
};
665666

666667
auto normAvg = [&](const std::vector<float>& avgs, const std::ptrdiff_t dim) -> float {

0 commit comments

Comments
 (0)