/*
* K many sub-samples of x_{t-1}
*/
final GaussianEnsParticle transStateTmp =
null;
// new GaussianEnsParticle(particle.getPrevParticle(),
// particle.getFilter(),
// particle.getObs(),
// particle.getState(),
// stateSample);
final double transStateLogLik =
this.updater.computeLogLikelihood(transStateTmp, data)
+ particlePriorLogLik;
final GaussianEnsParticle transState =
this.forwardParticle(particle, data);
logLikelihoods.add(transStateLogLik);
particleSupport.add(transState);
particleTotalLogLikelihood =
ExtLogMath.add(particleTotalLogLikelihood, transStateLogLik
+ Math.log(particleCount));
}
}
final CountedDataDistribution<GaussianEnsParticle> resampledParticles;
/*
* Water-filling resample, for a smoothed predictive set
*/
resampledParticles =
ExtSamplingUtils.waterFillingResample(
Doubles.toArray(logLikelihoods),
particleTotalLogLikelihood, particleSupport,
this.random, this.numParticles);
ResampleType resampleType = ((WFCountedDataDistribution) resampledParticles)
.wasWaterFillingApplied() ?
ResampleType.WATER_FILLING:
ResampleType.NO_REPLACEMENT;
/*
* Update sufficient stats.
*/
final CountedDataDistribution<GaussianEnsParticle> updatedDist =
new CountedDataDistribution<GaussianEnsParticle>(true);
for (final Entry<GaussianEnsParticle, MutableDouble> entry : resampledParticles
.asMap().entrySet()) {
final GaussianEnsParticle updatedEntry =
this.updater.update(entry.getKey());
updatedEntry.setResampleType(resampleType);
updatedEntry.setStateLogWeight(entry.getValue().doubleValue());
updatedDist.set(updatedEntry, entry.getValue().doubleValue(),
((MutableDoubleCount) entry.getValue()).count);
}
Preconditions