Package gov.sandia.cognition.statistics.distribution

Examples of gov.sandia.cognition.statistics.distribution.MultivariateGaussian


    final Vector aSmooth = a.plus(Wtil.times(y.minus(FG.times(a))));
    final Matrix RSmooth =
        R.minus(Wtil.times(A).times(Wtil.transpose()));
   
    return new MultivariateGaussian(aSmooth, RSmooth);
  }
View Full Code Here


        A.transpose().solve(FG.times(C.transpose())).transpose();

    final Vector mSmooth = m.plus(Wtil.times(y.minus(FG.times(m))));
    final Matrix CSmooth =
        C.minus(Wtil.times(A).times(Wtil.transpose()));
    return new MultivariateGaussian(mSmooth, CSmooth);
  }
View Full Code Here

      final DataDistribution<FruehwirthMultiParticle> initialParticles =
          CountedDataDistribution.create(true);
      for (int i = 0; i < numParticles; i++) {
       
        final MultivariateGaussian initialPriorState = initialPrior.clone();
        final KalmanFilter kf = this.initialFilter.clone();
       
        /*
         * Without an observation, start with any category...
         */
 
View Full Code Here

        invOmegaSamples.setElement(i, 1d / omega);
        z.setElement(i, (y.getElement(i) - 0.5d) / omega);
      }
      final Matrix zCov = MatrixFactory.getDenseDefault().createDiagonal(invOmegaSamples);

      final MultivariateGaussian augmentedPriorPredictiveLikelihood =
          new MultivariateGaussian(z, zCov);

      particle.setAugmentedResponseDistribution(augmentedPriorPredictiveLikelihood);


      particle.setPriorPredictiveMean(phi);

      return augmentedPriorPredictiveLikelihood.getProbabilityFunction().logEvaluate(phi);
    }
View Full Code Here

          }
        });
    for (Entry<LogitPGParticle, ? extends Number> particleEntry : target.asMap().entrySet()) {
      final LogitPGParticle particle = particleEntry.getKey();

      final MultivariateGaussian predictivePrior = particle.getLinearState().clone();
      KalmanFilter kf = particle.getRegressionFilter();
      final Matrix G = kf.getModel().getA();
      final Matrix F = data.getObservedData();
      predictivePrior.setMean(G.times(predictivePrior.getMean()));
      predictivePrior.setCovariance(
          G.times(predictivePrior.getCovariance()).times(G.transpose())
            .plus(kf.getModelCovariance()));
      final Vector betaMean = predictivePrior.getMean();
     
      final double k_t = data.getObservedValue().getElement(0) - 1d/2d;

      final int particleCount;
      if (particleEntry.getValue() instanceof MutableDoubleCount) {
        particleCount = ((MutableDoubleCount)particleEntry.getValue()).count;
      } else {
        particleCount = 1;
      }
      for (int p = 0; p < particleCount; p++) {

        for (int j = 0; j < K; j++) {

          /*
           * Sample and compute the latent variable...
           */
          final double omega = PolyaGammaDistribution.sample(0d, this.getRandom());
          final double z_t = k_t / omega;
         
          final LogitPGParticle predictiveParticle = particle.clone();
          predictiveParticle.setPreviousParticle(particle);
          predictiveParticle.setBetaSample(betaMean);
          predictiveParticle.setLinearState(predictivePrior);
         
          predictiveParticle.setAugResponseSample(
              VectorFactory.getDefault().copyValues(z_t));

          /*
           * Update the observed data for the regression component.
           */
          predictiveParticle.getRegressionFilter().getModel().setC(F);

          final Matrix compVar = MatrixFactory.getDefault().copyArray(
              new double[][] {{1d/omega}});
          predictiveParticle.getRegressionFilter().setMeasurementCovariance(compVar);
         
          final double compPredPriorObsMean = F.times(betaMean).getElement(0) ;
          final double compPredPriorObsCov =
               F.times(predictivePrior.getCovariance()).times(F.transpose()).getElement(0, 0)
               + 1d/omega;
          predictiveParticle.setPriorPredMean(compPredPriorObsMean);
          predictiveParticle.setPriorPredCov(compPredPriorObsCov);

          final double logLikelihood =
View Full Code Here

      LogitPGParticle priorParticle, ObservedValue<Vector, Matrix> data) {

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

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

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

      final DataDistribution<LogitPGParticle> initialParticles =
          CountedDataDistribution.create(true);
      for (int i = 0; i < numParticles; i++) {
       
        final MultivariateGaussian initialPriorState = initialPrior.clone();
        final KalmanFilter kf = this.initialFilter.clone();
       
        final LogitPGParticle particleMvgDPDist =
            new LogitPGParticle(null, kf, initialPriorState);
        initialParticles.increment(particleMvgDPDist);
View Full Code Here

    });
    final Matrix phiCov = MatrixFactory.getDefault().copyArray(new double[][] {
        {2d + 4d * sigmaPriorMean, 0d},
        { 0d, 4d * sigmaPriorMean}
    });
    final MultivariateGaussian phiPrior = new MultivariateGaussian(phiMean, phiCov);

    final int K = 3;
    final int T = 200;
    final int N = 1000;

View Full Code Here

      // stupid hack for a java bug
      final Object pobj = particle;
      Preconditions.checkState(pobj instanceof GaussianArHpWfParticle);
      GaussianArHpWfParticle gParticle = (GaussianArHpWfParticle) pobj;

      MultivariateGaussian state = gParticle.getState();
      stateAvg.accumulate(state.getMean().scale(particleWeight));

      MultivariateGaussian psi = gParticle.getPsiSS();
      psiAvg.accumulate(psi.getMean().scale(particleWeight));
     
      double sigma2Mean = gParticle.getSigma2SS().getMean();
      sigma2Avg.accumulate(new MutableDouble(sigma2Mean * particleWeight));

    }
View Full Code Here

            - 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

TOP

Related Classes of gov.sandia.cognition.statistics.distribution.MultivariateGaussian

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.