Testing of hmm (hidden Markov) algorithm in Apache mahout

Source: Internet
Author: User

The Hidden Markov model (Hidden Markov MODEL,HMM) is a statistical model of probability, which is used to describe a Markov process with hidden unknown parameters. The difficulty is to determine the implicit parameters of the procedure from observable parameters.

Hmm normal is mainly used to solve three kinds of problems, the corresponding three types of problems are related to the algorithm. Evaluation PROBLEM: Forward algorithm * * decoding PROBLEM: Viterbi algorithm * * Learning problem: Baum-welch algorithm (forward backward algorithm)

Mahout actually actually supported these algorithms, so the next experiment.

   

(1) test according to the example given by Mahout official documentation. (https://mahout.apache.org/users/classification/hidden-markov-models.html

First define an input:

$ echo "0 1 2 2 2 1 1 0 0 3 3 3 2 1 2 1 1 1 1 2 2 2 0 0 0 0 0 0 2 2 2 0 0 0 0 0 0 2 2 2 3 3 3 3 3 3 2 3 2 3 0 0 0 1 0 1 0 2 1 2 1 2 1 2 3 3 3 3 2 2 3 2 1 1 0 "> Hmm-input
Then test the Baum-welch algorithm.
$ export mahout_local=true
$ $MAHOUT _home/bin/mahout baumwelch-i hmm-input-o hmm-model-nh 3-no 4-e. 0001-M 1000

Finally return the predicted result value:

$ $MAHOUT _home/bin/mahout hmmpredict-m Hmm-model-o hmm-predictions-l 10

Easy test success, done. The result is as shown in the figure.



(2) The example of part-of-speech judgment in the mahout example is verified, and the result is as shown in the figure:





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.