/ hist[-self.window_size-1:-1])
mean = diff.mean()
// unbiased std of mean
std = diff.std() / (self.window_size - 1)**.5
t = abs(mean / std)
p = stats.t.cdf(t, df=self.window_size) - .5
// 1 - confidence is lower allowed p
if p < self.critical:
After Change
else:
window = int(max(0.1 * self.steps // self.every, 2.0))
losses = hist[::self.every][-window:]
diff = np.abs((losses[1:]-losses[:-1])/losses[:-1])
mean = np.mean(diff)
med = np.median(diff)
if mean < self.tolerance or med < self.tolerance:
raise StopIteration