def __init__(self, alpha=0.05, beta=0.05, elo0=0, elo1=5): self.a = math.log(beta / (1 - alpha)) self.b = math.log((1 - beta) / alpha) self.elo0 = elo0 self.elo1 = elo1 self.s0 = LLRcalc.L_(elo0) self.s1 = LLRcalc.L_(elo1) self.clamped = False self.LLR_drift_variance = LLRcalc.LLR_drift_variance_alt2
def elo_to_score(self, elo): """ "elo" is expressed in our current elo_model.""" if self.elo_model == "normalized": nt = elo / LLRcalc.nelo_divided_by_nt return nt * self.sigma_pg + 0.5 else: return LLRcalc.L_(elo)
def lelo_to_elo(self, lelo): """ For external use. "elo" is expressed in our current elo_model. "lelo" is logistic.""" if self.elo_model == "logistic": return lelo score = LLRcalc.L_(lelo) nt = (score - 0.5) / self.sigma_pg return nt * LLRcalc.nelo_divided_by_nt
def outcome_prob(self, elo): """ The probability of a test with the given elo with worse outcome (faster fail, slower pass or a pass changed into a fail).""" s = LLRcalc.L_(elo) mu_LLR, var_LLR = self.LLR_drift_variance(self.pdf, self.s0, self.s1, s) sigma_LLR = math.sqrt(var_LLR) return Brownian(a=self.a, b=self.b, mu=mu_LLR, sigma=sigma_LLR).outcome_cdf(T=self.T, y=self.llr)