[Machine Learning] Apriori algorithm

Source: Internet
Author: User

Applicable occasions

The Apriori algorithm consists of two parts: 1, discovering frequent itemsets 2, and Mining Association rules.

In layman's words, that's what it means: 1. Find out which items often appear at the same time 2. Discover whether these frequently occurring projects have a "if B" relationship.

For example: Online shopping orders often come up with a situation where several items are often bought together. For example, pots and shovels, mobile phones and mobile phone shells will often appear in the same order, so the excavation of which projects often occur at the same time is the problem of 1. Further, for these frequently occurring frequent itemsets, if can dig out "if A is B" stronger relationship, it is better. For example, buying a mobile phone will often buy a mobile phone shell, but the reverse is not true.

Discover frequent itemsets

The most intuitive idea of discovering frequent itemsets is to find a way to combine all the projects, that is, to produce 2n, and then calculate the most frequent combinations of these different types. But this method of search space is too large, very slow. The Apriori theorem can narrow the search space to a large extent: all non-empty sets of any frequent itemsets must also be frequent, that is to say, the superset of any non-frequent itemsets must also be a non-frequent itemsets. This allows you to directly delete all collections that contain non-frequent itemsets, greatly reducing the search space.

Reproduced a picture, very clearly explain the truth of it:

(Image source: http://www.jianshu.com/p/00103435ef89)

Mining Association Rules

Mining Association rules are based on frequent itemsets. Let's say we've found several frequent itemsets, and now we're going to find out if there's a causal relationship between "if B".

To calculate whether there is a causal relationship, the intuitive idea is to calculate the conditional probability P (b| A) to see if the probability of B is high enough under a condition.

Terms

Assume that the itemsets have a A, B.

With the above foreshadowing, the term definition is now introduced:

Support: P (AB), A and B are at the same time the probability of occurrence. The larger the more frequent.

Confidence level (confidence): P (b| A), conditional probability. The bigger the British, the stronger the UK.

Lifting degree (lift): P (b| A)/P (b), the ratio of the probability that B appears when there is a condition of a and there is no such condition.

[Machine Learning] Apriori algorithm

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.