Package plm.util.hmm.gaussian

Examples of plm.util.hmm.gaussian.GaussianArHmmClassEvaluator


    wfFilter.setNumParticles(N);
    wfFilter.setResampleOnly(false);

    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());
        }
      }

    }
View Full Code Here


    wfFilter.setNumParticles(N);
    wfFilter.setResampleOnly(false);

    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());
        }
      }

    }
View Full Code Here

TOP

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

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.