Package org.wiigee.logic

Examples of org.wiigee.logic.HMM


      BufferedWriter out = new BufferedWriter(new FileWriter(name+".txt"));
      int numStates = m.getNumStates();
      int numObservations = m.getNumObservations();
      double defaultProbability = m.getDefaultProbability();
      Quantizer quantizer = m.getQuantizer();
      HMM hmm = m.getHMM();
     
      out.write("# numStates:");
      out.newLine();
      out.write(Integer.toString(numStates));
      out.newLine();
     
      out.write("# numObservations:");
      out.newLine();
      out.write(Integer.toString(numObservations));
      out.newLine();
     
      out.write("# defaultProbability:");
      out.newLine();
      out.write(Double.toString(defaultProbability));
      out.newLine();
     
      out.write("# Quantizer: Radius");
      out.newLine();
      out.write(Double.toString(quantizer.getRadius()));
      out.newLine();
      out.write("# Quantizer: MAP");
      out.newLine();
      double[][] map = quantizer.getHashMap();
      for(int v=0; v<map.length; v++) {
        double[] d = map[v];
        out.write(Double.toString(d[0])+", "+Double.toString(d[1])+", "+Double.toString(d[2]));
        out.newLine();
      }
     
      out.write("# HMM: PI");
      out.newLine();
      double[] pi = hmm.getPi();
      for (int i=0; i<numStates; i++) {
        if(i==numStates-1) {
          out.write(Double.toString(pi[i]));
          out.newLine();
        } else {
          out.write(Double.toString(pi[i])+", ");
        }
      }
     
      out.write("# HMM: A");
      out.newLine();
      double[][] a = hmm.getA();
      for(int i=0; i<numStates; i++) {
        for(int j=0; j<numStates; j++) {
          if(j==numStates-1) {
            out.write(Double.toString(a[i][j]));
            out.newLine();
          } else {
            out.write(Double.toString(a[i][j])+", ");
          }
        }
      }
     
      out.write("# HMM: B");
      out.newLine();
      double[][] b = hmm.getB();
      for(int i=0; i<numStates; i++) {
        for(int j=0; j<numObservations; j++) {
          if(j==numObservations-1) {
            out.write(Double.toString(b[i][j]));
            out.newLine();
View Full Code Here


     
      Quantizer quantizer = new Quantizer(numStates);
      quantizer.setUpManually(map, radius);
      ret.setQuantizer(quantizer);
     
      HMM hmm = new HMM(numStates, numObservations);
      hmm.setPi(pi);
      hmm.setA(a);
      hmm.setB(b);
      ret.setHMM(hmm);
     
      return ret;
    } catch (Exception e) {
      System.out.println("Error: Read from File!");
View Full Code Here

TOP

Related Classes of org.wiigee.logic.HMM

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.