Package gov.sandia.cognition.math.matrix

Examples of gov.sandia.cognition.math.matrix.Vector.dotProduct()


      /*
       * 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)).
View Full Code Here


      final MultivariateGaussian priorPhi = predState.getPsiSS();
      final Vector phiPriorSmpl = priorPhi.sample(this.rng);
      final Vector xHdiff = postStateSample.minus(H.times(phiPriorSmpl));

      final double newN = scaleSS.getShape() + 1d;
      final double d = scaleSS.getScale() + xHdiff.dotProduct(xHdiff);
     
      scaleSS.setScale(d);
      scaleSS.setShape(newN);
     
      // FIXME TODO: crappy sampler
View Full Code Here

    final List<ObservedValue<Vector, Matrix>> observations = Lists.newArrayList();
    for (int i = 0; i < 10000; i++) {
//      final Vector dataSample = dataGeneratingDist.sample(rng);
      final Vector dataSample = VectorFactory.getDenseDefault().copyArray(new
        double[] {1d});
      final double phi = Math.exp(-trueGlobalMean - dataSample.dotProduct(trueBetas));
      final double pi = 1d / (1d + phi);
      final Vector y = VectorFactory.getDenseDefault().createVector1D(rng.nextDouble() <= pi ? 1d : 0d);
      final Matrix dataDesign = MatrixFactory.getDenseDefault().copyRowVectors(dataSample);
      observations.add(ObservedValue.create(i, y, dataDesign));
    }
View Full Code Here

      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);
      invScaleSS.setShape(newN);
     
      // FIXME TODO: crappy sampler
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.