HMM

January 30th, 2013

Home Forums General HMM

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by  Borky 4 years, 8 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #226

    eli
    Member

    Hi,

    Thanks for the great job. I need to use BaumWelch algorithm to predict HMM model based on my data set which is a time series data set.  Can some one help me what are the steps I need to take for that? In examples I couldn’t find any thing related to hmm. I’m using gov-sandia-cognition-learning-core-3.3.2.jar.

    I appreciate any help.

    #227

    Borky
    Member

    Hi Eli,

    Thanks for the note.  We typically direct people to the unit tests if there’s no direct Example that shows how to use a particular package. Let me know if this sample from the unit test helps explain things:

    /**
    * Learn
    */
    public void testMultiSequenceLearn()
    {
    System.out.println( “Multi-sequence learn” );

    HiddenMarkovModel<Vector> target = this.createHMMInstance();
    final int numSequences = 100;
    ArrayList<ArrayList<Vector>> sequences =
    new ArrayList<ArrayList<Vector>>( numSequences );
    for( int k = 0; k < numSequences; k++ )
    {
    sequences.add( target.sample(RANDOM, 10) );
    }

    DefaultMultiCollection<Vector> data =
    new DefaultMultiCollection<Vector>( sequences );
    sequences = null;

    System.out.println( “TARGET: ” + target );
    double l1 = target.computeMultipleObservationLogLikelihood(data.subCollections());
    System.out.println( “TARGET Log Likelihood: ” + l1 );

    // FALSE: Result Log Likelihood: -114550.38265183996
    BaumWelchAlgorithm<Vector> learner = this.createInstance();
    learner.setReestimateInitialProbabilities(true);
    double l0 = learner.getInitialGuess().computeMultipleObservationLogLikelihood( data.subCollections() );
    System.out.println( “INITIAL Log Likelihood: ” + l0 );
    learner.setMaxIterations(1000);

    HiddenMarkovModel<Vector> result = learner.learn(data);
    System.out.println( “Result: ” + learner.getIteration() + “: ” + result );
    double l2 = result.computeMultipleObservationLogLikelihood(data.subCollections());
    System.out.println( “Result Log Likelihood: ” +  l2 );

    }

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

Comments are closed.