Big security Hmm

Source: Internet
Author: User

Source Address: http://blog.csdn.net/ppn029012/article/details/8923501

1. Gambling events (background)

Recently, a casino boss found that the business was poor, so he sent his hand to look at the casino. In return, an uncle always wins and plays well in the casino.Dice, Almost invincible. In addition, when you play dice, there are several bodyguards around you standing around. People can only see each start, the dice fly out, and the ground is calm. Based on years of experience, the boss speculated that this poor customer was using the "stealing and changing dice" method which he had missed for many years (Editor's note:Use the dice in your pocket to steal the even dice.). The boss is a cool man. He doesn't want to offend him or break the rules. I was worried. At this time, a handsome hmm guy came in and told my boss that he had a good solution.

 

You don't need to get close to it. Just install a camera in the distance and record the points of each round of dice.

Hmm will then use its powerful mathematical internal force to export the data.

1. Is this uncle busy?

2. How many scammers did he use? And whether the scam is currently being used.

3. What is the probability of each point of cheating dice?

 

Dear God, the boss can even figure out whether the guy named HMM is cheating or not without getting close to him. Then, when he is cheating, he will be arrested and the dice will be verified on the spot to make him speechless.

 

2. Who is hmm?

The casino owner also investigated hmm before launching the investigation.

Hidden Markov Model (HMM), also known as hidden Markov model, is a probability model used to describe a system.Recessive statusTransfer andRecessive status.

 

Implicit system statusIn this example, the system status refers to the state in which the uncle uses the dice.

{Normal dice, cheat dice 1, cheat dice 2 ,...}

Implicit statusThat is, what we can observe is the external manifestation characteristics produced by the recessive state. That is to say, the number of points thrown by the dice.

{1, 2, 3, 4, 5, 6}

HMM model will be described, SystemTransfer Probability of recessive state. That is, the probability of Uncle switching the dice is an example. At this time, the possibility of Uncle switching the dice is fully described.



Fortunately, such a complex probability transition diagram can be expressed in a simple matrix, where a _ {IJ} represents the probability of occurrence from the I state to the J state.


Of course, at the same time,Implicit status transitionProbability. That is, the probability distribution of each point in the dice, (e.g. cheat dice 1 has a 90% chance to throw to six, and cheat dice 2 has a 85% chance to throw to 'small '). the following figure shows an example,

 

The presentation and distribution probability of recessive states can also be expressed in a matrix,

 

 

Sum up these two things, that is, the entire HMM model.

 

This model describes the probability of implicit state transition and the distribution of the external probability of each State. In short, the HMM model can describe the frequency (the probability of dice replacement) of the uncle who threw the dice, and the probability distribution of the dice used by the uncle. With the HMM Model of uncle, he can see through the uncle and make him fully visible in the sun.

 

 

3. What can hmm do!

In summary, hmm can handle three problems,

3.1 Decoding)

Decoding is a series of dice. We need to see which dice are used for cheating and which are used for normal dice.

For example, a sequence of dice (3,6, 1, 2...) is given ..) and uncle's HMM model, we want to calculate the results of which dice (recessive State) may be the results of which dice (recessive State ).

3.2 Learning (learning)

Learning is to learn the probability of Uncle switching the dice from a series of dice. Of course, there is also the distribution probability of these dice points. This is HMM's mostTerrorAlso the mostComplex!!

3.3 Evaluation)

It is estimated that in ourAlready knownWhen the uncle's HMM model is used, the probability of a string of dice is estimated. For example, if we already know uncle's HMM model, we can directly estimate the probability that uncle threw 10 6 or 8 1 s.

 

4. How does hmm work? (This chapter requires the knowledge of probability theory, recursion, and dynamic planning. If you are not interested, you can skip section 5th)

 

4.1 Estimation

 

Estimation is the easiest way to do this. When we fully understand uncle's HMM model, we can easily estimate it.


Now we have uncle's state transfer probability matrix A, and B can make an estimation. For example, we want to know the probability that this uncle will roll 10 6 in a row in the next round? As follows:

 

This indicates that the initial recessive state (S0) is 1, that isNormal diceIn this case, the uncle threw 10 6 in a row.

Now the problem is difficult. Although we know the conversion probability of HMM and the observed state V {1: t}, we do not know the actual hidden state changes.

Well, we don't know the changes in the recessive state. Well, let's get started first.HypothesisOneRecessive state sequenceAssume that the first five of the uncles use normal dice and the last five use cheating dice.

Well, we can calculate the probability of throwing 10 to 6 under this implicit sequence assumption.

This probability is actually the product of probability B in a recessive state.

But the problem arises again. I just assumed the sequence of recessive states, but I don't know the actual sequence. What should I do. Easy to handleAllYou can try all the hidden state sequence combinations. So,

R is a set of all possible hidden state sequences. Well, now the problem seems to have been solved. We have been able to get the probability value by trying all the combinations and calculate the total probability of occurrence through a and B matrices.
But the problem arises again, and the possible set is too big. For example, if there are three dice and there are 10 choices, then the total combination will be 3 ^ 10 times... this magnitude of O (C ^ t) is too large. When the problem grows, the number of combinations will be larger than the possibility of calculation. Therefore, we need a more effective method for calculating the P (V (1: T) probability. For example, the algorithm can reduce the complexity of P (V1: T) computing to O (CT ).

With this equation, we can deduce the probability of P (V1: T) from the case where T = 0. Let's take a look at the possibility of Uncle throwing a 3, 2, 1 dice sequence (assuming the initial state is 1, that is, Uncle holding a normal dice before )?




4.2 Decoding)

The decoding process is to find the most likely hidden state sequence when a series of sequences are given and the HMM model is known.

It is represented by a mathematical formula. (V is the visible sequence of visible state, W is the recessive state sequence, and A and B are the state transition probability matrix of HMM)


Remember the following formula,

Then you can useEstimated (4.1)InForward Derivation, Calculate the maximum P (w (1: T), V (1: t )).

After completing the forward derivation, useBackward Tracing Method(Back tracking), to solve the recessive sequence that can make the P (w (1: T), V (1: t) the largest. this algorithm is called Viterbi algorithm ).

4.2.1 find the most likely hidden sequence by the Viterbi Algorithm

This is a kind of dynamic planning algorithm. The solutions are the same. Find the recursive equation and use forward derivation to solve it. then, the backward tracing method is used to find the combination that makes the equation reach the optimal solution. the following is a hidden sequence combination that is most likely to calculate the dice sequence {1, 2, 6. (initial status: 1 = normal dice ,)

Big security probing HMM (transfer)

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.