Package gov.sandia.cognition.math.matrix

Examples of gov.sandia.cognition.math.matrix.Matrix.times()


       * That would require a change here...
       */
      final MultivariateGaussian predictivePrior = particle.getLinearState().clone();
      KalmanFilter kf = particle.getRegressionFilter(particle.getCategoryId());
      final Matrix G = kf.getModel().getA();
      predictivePrior.setMean(G.times(predictivePrior.getMean()));
      predictivePrior.setCovariance(
          G.times(predictivePrior.getCovariance()).times(G.transpose())
            .plus(kf.getModelCovariance()));
      final Matrix F = kf.getModel().getC();

View Full Code Here


      final MultivariateGaussian predictivePrior = particle.getLinearState().clone();
      KalmanFilter kf = particle.getRegressionFilter(particle.getCategoryId());
      final Matrix G = kf.getModel().getA();
      predictivePrior.setMean(G.times(predictivePrior.getMean()));
      predictivePrior.setCovariance(
          G.times(predictivePrior.getCovariance()).times(G.transpose())
            .plus(kf.getModelCovariance()));
      final Matrix F = kf.getModel().getC();

      final UnivariateGaussian evComponent = particle.getEVcomponent();
      final double predPriorObsMean = F.times(predictivePrior.getMean()).getElement(0)
View Full Code Here

          G.times(predictivePrior.getCovariance()).times(G.transpose())
            .plus(kf.getModelCovariance()));
      final Matrix F = kf.getModel().getC();

      final UnivariateGaussian evComponent = particle.getEVcomponent();
      final double predPriorObsMean = F.times(predictivePrior.getMean()).getElement(0)
          + evComponent.getMean();
      final double predPriorObsCov = F.times(predictivePrior.getCovariance()).times(F.transpose())
          .plus(kf.getMeasurementCovariance()).getElement(0, 0);
      particle.setPriorPredMean(predPriorObsMean);
      particle.setPriorPredCov(predPriorObsCov);
View Full Code Here

      final Matrix F = kf.getModel().getC();

      final UnivariateGaussian evComponent = particle.getEVcomponent();
      final double predPriorObsMean = F.times(predictivePrior.getMean()).getElement(0)
          + evComponent.getMean();
      final double predPriorObsCov = F.times(predictivePrior.getCovariance()).times(F.transpose())
          .plus(kf.getMeasurementCovariance()).getElement(0, 0);
      particle.setPriorPredMean(predPriorObsMean);
      particle.setPriorPredCov(predPriorObsCov);

      double logLikelihood = UnivariateGaussian.PDF.logEvaluate(
View Full Code Here

      final Vector z = VectorFactory.getDenseDefault().createVector(1);
      /*
       * Now, we compute the predictive log odds, so that we can evaluate the likelihood.
       */
      final Matrix x = observation.getObservedData();
      final Vector phi = x.times(particle.getPriorBeta().getMean());
      for (int i = 0; i < y.getDimensionality(); i++) {
        final double omega = PolyaGammaLogitDistribution.sample(
          phi.getElement(i), rng);
        invOmegaSamples.setElement(i, 1d / omega);
        z.setElement(i, (y.getElement(i) - 0.5d) / omega);
View Full Code Here

      }
      currentState.plusEquals(currentFilter.getModel().getB().times(
          currentFilter.getCurrentInput()));

      final Matrix F = currentFilter.getModel().getC();
      Vector observationMean = F.times(currentState);
      Matrix measurementCovSqrt = CholeskyDecompositionMTJ.create(
          (DenseMatrix) currentFilter.getMeasurementCovariance()).getR();
      Vector observation = MultivariateGaussian.sample(observationMean,
          measurementCovSqrt, random);
 
View Full Code Here

            .plus(kf.getModelCovariance()));
      final Vector betaSample =
          predictivePrior.sample(getRandom());
//          predictivePrior.getMean();
      final double predPriorObsMean =
            F.times(betaSample).getElement(0);

      final int particleCount;
      if (particleEntry.getValue() instanceof MutableDoubleCount) {
        particleCount = ((MutableDoubleCount)particleEntry.getValue()).count;
      } else {
View Full Code Here

      final Vector y = observation.getObservedValue();
      /*
       * Now, we compute the predictive dist, so that we can evaluate the likelihood.
       */
      final Matrix X = observation.getObservedData();
      final Vector priorPredObsMean = X.times(particle.getPriorBeta().getMean());
      Matrix priorPredObsCov = X.times(
          particle.getPriorBeta().getCovariance())
          .times(X.transpose()).plus(particle.augLassoSample);
      priorPredObsCov.times(particle.priorObsCovSample);

View Full Code Here

      final Matrix X = observation.getObservedData();
      final Vector priorPredObsMean = X.times(particle.getPriorBeta().getMean());
      Matrix priorPredObsCov = X.times(
          particle.getPriorBeta().getCovariance())
          .times(X.transpose()).plus(particle.augLassoSample);
      priorPredObsCov.times(particle.priorObsCovSample);

      final MultivariateGaussian priorPredictiveObsDist=
          new MultivariateGaussian(priorPredObsMean, priorPredObsCov);

      return priorPredictiveObsDist.getProbabilityFunction().logEvaluate(y);
View Full Code Here

      H.setSubMatrix(0, 0, Ij);
      H.setSubMatrix(0, xDim, MatrixFactory.getDefault().createDiagonal(predState.getStateSample()));
      final Vector postStateSample = posteriorState.sample(this.rng);
      final MultivariateGaussian priorPhi = predState.getPsiSS().get(predState.getClassId());
      final Vector phiPriorSmpl = priorPhi.sample(this.rng);
      final Vector xHdiff = postStateSample.minus(H.times(phiPriorSmpl));

      final double newN = invScaleSS.getShape() + 1d;
      final double d = invScaleSS.getScale() + xHdiff.dotProduct(xHdiff);
     
      invScaleSS.setScale(d);
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.