diff --git a/misterdev/core/evolution/partial_credit.py b/misterdev/core/evolution/partial_credit.py index 472995b..9157e3d 100644 --- a/misterdev/core/evolution/partial_credit.py +++ b/misterdev/core/evolution/partial_credit.py @@ -20,6 +20,7 @@ regressions==0 + resolved_rate (see fitness.py). Pure and deterministic. """ +import math from dataclasses import dataclass from typing import Iterable, Optional, Sequence, Tuple @@ -99,8 +100,8 @@ def variance(self) -> float: """Sample variance of the per-task credits (population form).""" if self.total < 1: return 0.0 - m = self.mean_credit - return sum((c - m) ** 2 for c in self.credits) / self.total + m = math.fsum(self.credits) / self.total + return math.fsum((c - m) ** 2 for c in self.credits) / self.total @property def stderr(self) -> float: