Examples of InverseGammaDistribution


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

        initialClassProbs, classTransProbs);

    final double sigmaPriorMean = Math.pow(0.4, 2);
    final double sigmaPriorShape = 2d;
    final double sigmaPriorScale = sigmaPriorMean*(sigmaPriorShape + 1d);
    final InverseGammaDistribution sigmaPrior = new InverseGammaDistribution(sigmaPriorShape,
        sigmaPriorScale);
   
    final Vector phiMean1 = VectorFactory.getDefault().copyArray(new double[] {
        0d, 0.8d
    });
View Full Code Here

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

        int numParticles) {
      final CountedDataDistribution<GaussianArHpWfParticle> initialParticles =
          CountedDataDistribution.create(numParticles, true);
      for (int i = 0; i < numParticles; i++) {

        final InverseGammaDistribution thisSigma2Prior = this.initialPriorSigma2.clone();
        final double sigma2Sample = thisSigma2Prior.sample(this.rng);

        final KalmanFilter thisKf = this.initialKf.clone();
        final MultivariateGaussian thisPsiPrior = initialPriorPsi.clone();
        // TODO FIXME use t-distribution
        final MultivariateGaussian thisPsiPriorSmpler = thisPsiPrior.clone();
View Full Code Here

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

      H.setSubMatrix(0, 0, Ix);
      H.setSubMatrix(0, xDim,
          // x_{t-1}
          MatrixFactory.getDefault().createDiagonal(predState.getStateSample()));

      final InverseGammaDistribution sigma2SS = predState.getSigma2SS().clone();
      // TODO FIXME matrix inverse!!
      final Matrix postStatePrec = posteriorState.getCovarianceInverse().scale(
          sigma2SS.getShape()/sigma2SS.getScale());
      MultivariateStudentTDistribution postStateMarginal = new MultivariateStudentTDistribution(
          sigma2SS.getShape(),
          posteriorState.getMean(), postStatePrec);
      final Vector postStateSample = postStateMarginal.sample(this.rng);
     
      final Vector psiPriorSmpl = predState.getPsiSample();
      // x_t
      final Vector xHdiff = postStateSample.minus(H.times(psiPriorSmpl));

      /*
       * 1. Update the sigma2 sufficient stats.
       */
      final double newN = sigma2SS.getShape() + 1d;
      final double d = sigma2SS.getScale() + xHdiff.dotProduct(xHdiff);
      sigma2SS.setScale(d);
      sigma2SS.setShape(newN);
     
      /*
       * 2. Update psi sufficient stats. (i.e. offset and AR(1)).
       *
       * Note that we divide out the previous scale param, since
       * we want to update A alone.
       * TODO FIXME inverse!  ewww.
       */
      final Matrix priorAInv = predState.getPsiSS().getCovarianceInverse();
      /*
       * TODO FIXME: we don't have a generalized outer product, so we're only
       * supporting the 1d case for now.
       */
      final Vector Hv = H.convertToVector();
      /*
       * TODO FIXME inverse!  ewww.
       */
      final Matrix postAInv = priorAInv.plus(Hv.outerProduct(Hv)).inverse();
      final Vector postPsiMean = postAInv.times(priorAInv.times(psiPriorSmpl).plus(
          H.transpose().times(postStateSample)));
      final MultivariateGaussian postPsi = predState.getPsiSS().clone();
      postPsi.setMean(postPsiMean);
      postPsi.setCovariance(postAInv);
     
      final double sigma2Smpl = sigma2SS.sample(this.rng);
      final GaussianArHpWfParticle postState =
          new GaussianArHpWfParticle(kf, predState.getObservation(),
              posteriorState, postStateSample,
              sigma2SS, postPsi,
              sigma2Smpl, predState.getPsiSample());
View Full Code Here

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

     */
    MultivariateGaussian priorPredictedState = prevState.getState().clone();
    final KalmanFilter kf = prevState.getFilter().clone();
    kf.predict(priorPredictedState);
   
    final InverseGammaDistribution scaleSS = prevState.getSigma2SS().clone();
    final MultivariateGaussian systemSS = prevState.getPsiSS().clone();

    final GaussianArHpWfParticle newTransState =
        new GaussianArHpWfParticle(prevState, kf,
            data, priorPredictedState, prevState.getStateSample(),
View Full Code Here

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

    trueKf.setCurrentInput(VectorFactory.getDefault().copyValues(truePsi.getElement(0)));
   
    final double sigmaPriorMean = Math.pow(0.4, 2);
    final double sigmaPriorShape = 2d;
    final double sigmaPriorScale = sigmaPriorMean*(sigmaPriorShape - 1d);
    final InverseGammaDistribution sigmaPrior = new InverseGammaDistribution(sigmaPriorShape,
        sigmaPriorScale);
   
    final Vector phiMean = VectorFactory.getDefault().copyArray(new double[] {
        0d, 0.8d
    });
View Full Code Here

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

        initialClassProbs, classTransProbs);

    final double sigmaPriorMean = Math.pow(0.4, 2);
    final double sigmaPriorShape = 2d;
    final double sigmaPriorScale = sigmaPriorMean*(sigmaPriorShape + 1d);
    final InverseGammaDistribution sigmaPrior = new InverseGammaDistribution(sigmaPriorShape,
        sigmaPriorScale);
   
    final Vector phiMean1 = VectorFactory.getDefault().copyArray(new double[] {
        0d, 0.8d
    });
View Full Code Here

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

        initialClassProbs, classTransProbs);

    final double sigmaPriorMean = Math.pow(0.4, 2);
    final double sigmaPriorShape = 2d;
    final double sigmaPriorScale = sigmaPriorMean*(sigmaPriorShape + 1d);
    final InverseGammaDistribution sigmaPrior = new InverseGammaDistribution(sigmaPriorShape,
        sigmaPriorScale);
   
    final Vector phiMean1 = VectorFactory.getDefault().copyArray(new double[] {
        0d, 0.8d
    });
View Full Code Here

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

    kf.setCurrentInput(smplOffsetTerm);
 
    /*
     * Perform the Kalman update to get the posterior state suff. stats.
     */
    final InverseGammaDistribution priorSigma2 = prevState.getSigma2SS().clone();
    final double sigma2Sample = priorSigma2.sample(this.getRandom());
    MultivariateGaussian posteriorState = prevState.getState().clone();
    // TODO FIXME gross hack!
//    posteriorState.getCovariance().scaleEquals(sigma2Sample);
//    kf.setMeasurementCovariance(Iy.scale(sigma2Sample));
//    kf.setModelCovariance(Ix.scale(sigma2Sample));
View Full Code Here

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

      for (int i = 0; i < this.numSubSamples * particleCount; i++) {

        /*
         * K many sub-samples of x_{t-1} 
         */
        final InverseGammaDistribution sigma2SS = particle.getSigma2SS();
        // TODO FIXME matrix inverse!!
        final Matrix postStatePrec = particle.getState().getCovarianceInverse().scale(
            sigma2SS.getShape()/sigma2SS.getScale());
        MultivariateStudentTDistribution postStateMarginal = new MultivariateStudentTDistribution(
            sigma2SS.getShape(),
            particle.getState().getMean(), postStatePrec);
        final Vector stateSample = postStateMarginal.sample(this.getRandom());

        final GaussianArHpWfParticle transStateTmp =
            new GaussianArHpWfParticle(particle.getPrevParticle(),
View Full Code Here

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

    trueKf.setCurrentInput(VectorFactory.getDefault().copyValues(truePsi.getElement(0)));
   
    final double sigmaPriorMean = Math.pow(0.4, 2);
    final double sigmaPriorShape = 2d;
    final double sigmaPriorScale = sigmaPriorMean*(sigmaPriorShape - 1d);
    final InverseGammaDistribution sigmaPrior = new InverseGammaDistribution(sigmaPriorShape,
        sigmaPriorScale);
   
    final Vector phiMean = VectorFactory.getDefault().copyArray(new double[] {
        0d, 0.8d
    });
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.