new RingAccumulator<MutableDouble>();
for (int k = 0; k < K; k++) {
log.info("Processing replication " + k);
GaussianArHpEvaluator wfEvaluator = new GaussianArHpEvaluator("wf-pl",
truePsi, trueSigma2, null);
CountedDataDistribution<GaussianArHpWfParticle> wfDistribution =
(CountedDataDistribution<GaussianArHpWfParticle>) wfFilter.getUpdater().createInitialParticles(N);
final long numPreRuns = -1l;//wfDistribution.getMaxValueKey().getTime();
/*
* Recurse through the particle filter
*/
for (int i = 0; i < T; i++) {
if (i > numPreRuns) {
if (i > 0) {
wfWatch.reset();
wfWatch.start();
wfFilter.update(wfDistribution, simulations.get(i));
wfWatch.stop();
final long latency = wfWatch.elapsed(TimeUnit.MILLISECONDS);
wfLatency.accumulate(new MutableDouble(latency));
}
wfEvaluator.evaluate(k, simulations.get(i), wfDistribution);
}
if ((i+1) % (T/4d) < 1) {
log.info(Joiner.on("\t").join(new String[] {
Integer.toString(k),
Integer.toString(i),
Double.toString(wfLatency.getMean().value),
Double.toString(wfEvaluator.getStateLastRmse()),
Double.toString(wfEvaluator.getSigma2LastRmse()),
Double.toString(wfEvaluator.getPsiLastRmse())
// Double.toString(wfEvaluator.getRunningStateRmse()),
// Double.toString(wfEvaluator.getRunningSigma2Rmse()),
// Double.toString(wfEvaluator.getRunningPsiRmse())
}));
log.info(Joiner.on("\t").join(new String[] {
Integer.toString(k),
Integer.toString(i),
Double.toString(wfLatency.getMean().value),
"% " + Double.toString(wfEvaluator.getStateLastErrRate()),
"% " + Double.toString(wfEvaluator.getSigma2LastErrRate()),
"% " + Double.toString(wfEvaluator.getPsiLastErrRate())
// Double.toString(wfEvaluator.getRunningStateErrRate()),
// Double.toString(wfEvaluator.getRunningSigma2ErrRate()),
// Double.toString(wfEvaluator.getRunningPsiErrRate())
}));
}
}
wfStateRMSEs.accumulate(new MutableDouble(wfEvaluator.getStateLastErrRate()));
wfPsiRMSEs.accumulate(new MutableDouble(wfEvaluator.getPsiLastErrRate()));
wfSigma2RMSEs.accumulate(new MutableDouble(wfEvaluator.getSigma2LastErrRate()));
}
assertEquals(0d, wfStateRMSEs.getMean().doubleValue(), 1d/Math.sqrt(N));
}