You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That is, using the noisy quiz model and a successful quiz 100 halflives after last seen,
q0=0 ➜ expected behavior: the halflife jumps from 1 to 27
q0=1e-2 ➜ halflife barely changes?
Pourquoi?
Is this a numerical problem?
No I don't think so. I double-checked with Stan and I it agrees with the above.
Click here to see Stan and Python code
with the following Stan model file:
// ebisu.standata {
real<lower=0> t0;
real<lower=0> alpha;
real<lower=0> beta;
int<lower=0, upper=1> z;
real<lower=0, upper=1> q1;
real<lower=0, upper=1> q0;
real<lower=0> t;
real<lower=0> t2;
}
parameters {
real<lower=0, upper=1> p0;
// We WANT this:// `int<lower=0, upper=1> x;`// But we can't have it: https://mc-stan.org/docs/2_28/stan-users-guide/change-point.html// So we marginalize over x.
}
transformed parameters {
real<lower=0, upper=1> p =pow(p0, t / t0); // Precall at treal<lower=0, upper=1> p2 =pow(p, t2 / t); // Precall at t2
}
model {
p0 ~beta(alpha, beta); // Precall at t0// Again, we WANT the following:// `x ~ bernoulli(p);`// `z ~ bernoulli(x ? q1 : q0);`// But we can't so we had to marginalize:target+=log_mix(p, bernoulli_lpmf(z | q1), bernoulli_lpmf(z | q0));
// log_mix is VERY handy: https://mc-stan.org/docs/2_28/functions-reference/composed-functions.html
}
which is the Ebisu model except, we have to marginalize x the "true" Bernoulli quiz out because Stan, while very awesome, simply can't handle discrete parameters 😭. Thankfully the marginalization is quite straightforward:
P(z | p) = sum([P(z, x | p) for x in [0, 1])
= P(z | x=1) * P(x=1 | p) + P(z | x=0) * P(x=0 | p)
= Bernoulli(z; q1) * p + Bernoulli(z; q0) * (1-p)
With this model, we can double-check the analytical results we got from Ebisu:
Ebisu: new (alpha, beta) = 3.0874602456940186, 3.087460245694014
Stan: 3.083029695444059, 3.085366775525092
q0=1e-2:
Ebisu: 2.8931573238863244, 2.893157323886327
Stan: 2.8794053385199345, 2.8665345558604955
This is close enough that I have confidence in Ebisu. It's possible Stan is underflowing or overflowing or somehow losing precision but it's unlikely to be losing precision in the same way as Ebisu, which computes the posterior using an entirely different approach.
What's happening?
Checking the behavior of the updated model's halflife as we vary tnow (quiz time), using Ebisu:
For low tnow>1, the q0=0 and q0=1e-2 and q0=1e-3 curves are all very similar, but they begin to deviate: while the q0=0 case keeps rising linearly, the q0!=0 peak and drop asymptotically to 1.0.
Hypothesis This happens because, at tnow much higher than initial halflife, we have so much belief that a quiz will fail that any doubt about the true quiz result is magnified so we get a non-update.
As we show in the plot above, by modifying q0=1e-3 instead 1e-2, we can delay the peak in updated halflife to greater tnow. For some applications, this may be sufficient.
Nonetheless, this does point to a surprising behavior of the algorithm, and unfortunately means we might have to think hard about our choice of parameters for q0.
The text was updated successfully, but these errors were encountered:
@kirianguiller sent the following surprising snippet:
That is, using the noisy quiz model and a successful quiz 100 halflives after last seen,
Pourquoi?
Is this a numerical problem?
No I don't think so. I double-checked with Stan and I it agrees with the above.
Click here to see Stan and Python code
with the following Stan model file:
which is the Ebisu model except, we have to marginalize
x
the "true" Bernoulli quiz out because Stan, while very awesome, simply can't handle discrete parameters 😭. Thankfully the marginalization is quite straightforward:With this model, we can double-check the analytical results we got from Ebisu:
Comparing
new
(alpha, beta) = 3.0874602456940186, 3.087460245694014This is close enough that I have confidence in Ebisu. It's possible Stan is underflowing or overflowing or somehow losing precision but it's unlikely to be losing precision in the same way as Ebisu, which computes the posterior using an entirely different approach.
What's happening?
Checking the behavior of the updated model's halflife as we vary
tnow
(quiz time), using Ebisu:Click here for Python source code
For low
tnow>1
, theq0=0
andq0=1e-2
andq0=1e-3
curves are all very similar, but they begin to deviate: while theq0=0
case keeps rising linearly, theq0!=0
peak and drop asymptotically to 1.0.Hypothesis This happens because, at
tnow
much higher than initial halflife, we have so much belief that a quiz will fail that any doubt about the true quiz result is magnified so we get a non-update.As we show in the plot above, by modifying
q0=1e-3
instead 1e-2, we can delay the peak in updated halflife to greatertnow
. For some applications, this may be sufficient.Nonetheless, this does point to a surprising behavior of the algorithm, and unfortunately means we might have to think hard about our choice of parameters for q0.
The text was updated successfully, but these errors were encountered: