Package gov.sandia.cognition.statistics.bayesian

Examples of gov.sandia.cognition.statistics.bayesian.KalmanFilter


  private LogitMixParticle sufficientStatUpdate(
      LogitMixParticle priorParticle, ObservedValue<Vector, Matrix> data) {

    final LogitMixParticle updatedParticle = priorParticle.clone();
    final KalmanFilter filter = updatedParticle.getRegressionFilter();

    final UnivariateGaussian evComponent = updatedParticle.EVcomponent;

    final boolean isOne = !data.getObservedValue().isZero();

    final int smplLowerIdx = DiscreteSamplingUtil.sampleIndexFromProportions(
        getRandom(), updatedParticle.getComponentLikelihoods());
//    final int smplLowerIdx = DiscreteSamplingUtil.sampleIndexFromProbabilities(
//        getRandom(), this.evDistribution.getPriorWeights());

    final UnivariateGaussian partComponent =
        this.evDistribution.getDistributions().get(smplLowerIdx);

    final double dsampledAugResponse = sampleAugResponse(
        updatedParticle.getPriorPredMean(),
        updatedParticle.getPriorPredCov(), isOne,
        partComponent);

    // TODO we should've already set this, so it might be redundant.
    filter.setMeasurementCovariance(
        MatrixFactory.getDefault().copyArray(new double[][] {{
          evComponent.getVariance() + partComponent.getVariance()}}));

    final Vector sampledAugResponse =
        VectorFactory.getDefault().copyValues(
            dsampledAugResponse
            - evComponent.getMean().doubleValue()
            - partComponent.getMean().doubleValue());

    updatedParticle.setAugResponseSample(sampledAugResponse);

    final MultivariateGaussian posteriorState = updatedParticle.getLinearState().clone();
    filter.update(posteriorState, sampledAugResponse);

    updatedParticle.setLinearState(posteriorState);
   
    return updatedParticle;
  }
View Full Code Here


    public double computeLogLikelihood(
      GaussianArHpTransitionState transState,
      ObservedValue<Vector,Void> observation) {

      final MultivariateGaussian priorPredState = transState.getState();
      final KalmanFilter kf = Iterables.get(transState.getHmm().getStateFilters(),
          transState.getClassId());
      /*
       * Construct the measurement prior predictive likelihood
       */
      final Vector mPriorPredMean = kf.getModel().getC().times(priorPredState.getMean());
      final Matrix mPriorPredCov = kf.getModel().getC().times(priorPredState.getCovariance())
          .times(kf.getModel().getC().transpose())
          .plus(kf.getMeasurementCovariance());
      final MultivariateGaussian mPriorPredDist = new MultivariateGaussian(
          mPriorPredMean, mPriorPredCov);

      final double logCt = mPriorPredDist.getProbabilityFunction().logEvaluate(
          observation.getObservedValue());
View Full Code Here

TOP

Related Classes of gov.sandia.cognition.statistics.bayesian.KalmanFilter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.