Package plm.util.hmm.gaussian

Examples of plm.util.hmm.gaussian.GaussianArHmmRmseEvaluator


    List<SimHmmObservedValue<Vector, Vector>> simulation = dlmHmm.sample(random, T);

    rsFilter.setNumParticles(N);

    GaussianArHmmRmseEvaluator mkfRmseEvaluator = new GaussianArHmmRmseEvaluator("mkf",
        null);

    for (int k = 0; k < K; k++) {
      log.info("Processing replication " + k);

      DataDistribution<GaussianArTransitionState> rsDistribution =
          rsFilter.getUpdater().createInitialParticles(N);

      /*
       * Recurse through the particle filter
       */
      for (int i = 0; i < T; i++) {
 
        final double x = simulation.get(i).getClassId();
        final Double y = simulation.get(i).getObservedValue().getElement(0);
        // lame hack need until I refactor to use DlmHiddenMarkovModel in the filters
        final ObservedValue<Double, Void> obsState = new SimHmmObservedValue<Double, Double>(i,
           (int)x , simulation.get(i).getState().getElement(0), y);

        if (i > 0) {
          rsFilter.update(rsDistribution, obsState);
          mkfRmseEvaluator.evaluate(k, simulation.get(i), rsDistribution);
        }

        if ((i+1) % (T/4d) < 1) {
          log.info("avg. mkfRmse=" + mkfRmseEvaluator.getTotalRate().getMean().value);
        }
      }
      assertEquals(0d, mkfRmseEvaluator.getTotalRate().getMean().value, 9e-1);
    }
  }
View Full Code Here


    log.info("rep\tt\tfilter.type\tmeasurement.type\tresample.type\tmeasurement");

    GaussianArHmmClassEvaluator wfClassEvaluator = new GaussianArHmmClassEvaluator("wf-pl",
        null);
    GaussianArHmmRmseEvaluator wfRmseEvaluator = new GaussianArHmmRmseEvaluator("wf-pl",
        null);
    GaussianArHmmPsiLearningEvaluator wfPsiEvaluator = new GaussianArHmmPsiLearningEvaluator("wf-pl",
        truePsis, null);

    RingAccumulator<MutableDouble> wfLatency =
        new RingAccumulator<MutableDouble>();
    Stopwatch wfWatch = new Stopwatch();


    for (int k = 0; k < K; k++) {
      log.info("Processing replication " + k);
      CountedDataDistribution<GaussianArHpTransitionState> wfDistribution =
          (CountedDataDistribution<GaussianArHpTransitionState>) wfFilter.getUpdater().createInitialParticles(N);


      final long numPreRuns = -1l;//wfDistribution.getMaxValueKey().getTime();
     
      /*
       * Recurse through the particle filter
       */
      for (int i = 0; i < T; i++) {
 
        final double x = simulation.get(i).getClassId();
        final Vector y = simulation.get(i).getObservedValue();

        if (i > numPreRuns) {

          if (i > 0) {
            wfWatch.reset();
            wfWatch.start();
            wfFilter.update(wfDistribution, simulation.get(i));
            wfWatch.stop();
            final long latency = wfWatch.elapsed(TimeUnit.MILLISECONDS);
            wfLatency.accumulate(new MutableDouble(latency));
            log.info(Joiner.on("\t").join(new String[] {
                Integer.toString(k), Integer.toString(i),
                "wf-pl", "latency", "NA",
                Long.toString(latency)})
                );
          }
         
          wfClassEvaluator.evaluate(k, simulation.get(i), wfDistribution);
          wfRmseEvaluator.evaluate(k, simulation.get(i), wfDistribution);
          wfPsiEvaluator.evaluate(k, simulation.get(i), wfDistribution);
        }

        if ((i+1) % (T/4d) < 1) {
          log.info("avg. wf latency=" + wfLatency.getMean().value);
          log.info("avg. wfRmse=" + wfRmseEvaluator.getTotalRate().getMean().value);
          log.info("avg. wfClassRate=" + wfClassEvaluator.getTotalRate().getMean().value);
          log.info("avg. wfPsi=" + wfPsiEvaluator.getTotalRate());
        }
      }

    }

    assertEquals(0d, wfRmseEvaluator.getTotalRate().getMean().value, 9e-1);
  }
View Full Code Here

    log.info("rep\tt\tfilter.type\tmeasurement.type\tresample.type\tmeasurement");

    GaussianArHmmClassEvaluator wfClassEvaluator = new GaussianArHmmClassEvaluator("wf-pl",
        null);
    GaussianArHmmRmseEvaluator wfRmseEvaluator = new GaussianArHmmRmseEvaluator("wf-pl",
        null);
    GaussianArHmmPsiLearningEvaluator wfPsiEvaluator = new GaussianArHmmPsiLearningEvaluator("wf-pl",
        truePsis, null);

    RingAccumulator<MutableDouble> wfLatency =
        new RingAccumulator<MutableDouble>();
    Stopwatch wfWatch = new Stopwatch();


    for (int k = 0; k < K; k++) {
      log.info("Processing replication " + k);
      CountedDataDistribution<GaussianArHpTransitionState> wfDistribution =
          (CountedDataDistribution<GaussianArHpTransitionState>) wfFilter.getUpdater().createInitialParticles(N);


      final long numPreRuns = -1l;//wfDistribution.getMaxValueKey().getTime();
     
      /*
       * Recurse through the particle filter
       */
      for (int i = 0; i < T; i++) {
 
        final double x = simulation.get(i).getClassId();
        final Vector y = simulation.get(i).getObservedValue();

        if (i > numPreRuns) {

          if (i > 0) {
            wfWatch.reset();
            wfWatch.start();
            wfFilter.update(wfDistribution, simulation.get(i));
            wfWatch.stop();
            final long latency = wfWatch.elapsed(TimeUnit.MILLISECONDS);
            wfLatency.accumulate(new MutableDouble(latency));
            log.info(Joiner.on("\t").join(new String[] {
                Integer.toString(k), Integer.toString(i),
                "wf-pl", "latency", "NA",
                Long.toString(latency)})
                );
          }
         
          wfClassEvaluator.evaluate(k, simulation.get(i), wfDistribution);
          wfRmseEvaluator.evaluate(k, simulation.get(i), wfDistribution);
          wfPsiEvaluator.evaluate(k, simulation.get(i), wfDistribution);
        }

        if ((i+1) % (T/4d) < 1) {
          log.info("avg. wf latency=" + wfLatency.getMean().value);
          log.info("avg. wfRmse=" + wfRmseEvaluator.getTotalRate().getMean().value);
          log.info("avg. wfClassRate=" + wfClassEvaluator.getTotalRate().getMean().value);
          log.info("avg. wfPsi=" + wfPsiEvaluator.getTotalRate());
        }
      }

    }

    assertEquals(0d, wfRmseEvaluator.getTotalRate().getMean().value, 9e-1);
  }
View Full Code Here

TOP

Related Classes of plm.util.hmm.gaussian.GaussianArHmmRmseEvaluator

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.