Prior algorithm (Apriori algorithm)-Machine learning algorithm

Source: Internet
Author: User

Apriori is a algorithm for frequent item set Mining and association rule learning over transactional databases. It proceeds by identifying the frequent individual items on the database and extending them to larger and larger item sets As long as those item sets appear sufficiently often in the database. The frequent item sets determined by Apriori can is used to determine association rules which highlight general trends in The database:this have applications in domains such as Market basket analysis.

In the field of computer science and data mining, the transcendental algorithm is one of the classical algorithms in the Association rules. A priori algorithm is designed to process a database that contains transactional information (for example, a list of goods purchased by a customer, or a list of frequently visited pages). Other algorithms are the rules of association that are designed to look for data that has no transactional information (such as the WINEPI algorithm and the MINEPI algorithm) or that has no time markers (such as DNA sequencing).

In an associative rule, the algorithm typically attempts to find at least c the same subset in the project collection for a given set of items (for example, a retail transaction collection, a purchase of a single item listed in each collection). The Apriori algorithm uses a bottom-up approach, that is, the frequent subset expands only one object at a time (this step is called the candidate set generation), and the candidate set is validated by the data. The algorithm terminates when an extension object that meets the criteria is no longer produced.

The transcendental algorithm uses the breadth-first search algorithm to search and uses the tree structure to count the candidate itemsets efficiently. It produces a candidate set of length {\displaystyle k} with a candidate set of length {\displaystyle k-1} , and then removes the candidate with the uncommon sub-pattern from it. Based on the down-closed lemma, this candidate set contains all frequent itemsets with a length of {\displaystyle k}. You can then scan the transaction database to determine the frequent set of items in the candidate project set.

Although the prior algorithm has a significant historical position, some of the inefficiencies and tradeoffs in these algorithms have resulted in many other algorithms. The candidate set generation process generates a large number of subsets (prior algorithms always try to load as many candidate sets as possible before each scan of the database). And the bottom-up subset of the browse process (which is essentially a subset of width-first traversal) is also done until all {\displaystyle 2^{| are traversed s|} -1} A possible subset to find any maximum subset S.

Example

A large supermarket tracks the sales data for each item according to the minimum inventory unit (SKU). It is also possible to know where items are usually purchased at the same time. It is an efficient way to build a list of frequently purchased portfolios from these sales data by using a priori algorithm. Assume that the transaction database contains the following subset {1,2,3,4},{1,2},{2,3,4},{2,3},{1,2,4},{3,4},{2,4}. Each label represents a commodity, such as "butter" or "bread". The prior algorithm first calculates the purchase frequency of a single commodity separately. The following table explains the purchase frequency of a single commodity derived from a priori algorithm.

Product number Number of purchases
1 3
2 6
3 4
4 5

Then we can define a minimum number of purchases to define the so-called "frequent". In this example, we define a minimum purchase count of 3. Therefore, all purchases are for frequent purchases. Next, generate a combination of frequently purchased items and the frequency of purchase. A priori algorithm makes this step by modifying all possible subsets in the tree structure. Then we only re-select the frequently purchased portfolio:

Product number Number of purchases
{A} 3
{2,3} 3
{2,4} 4
{3,4} 3

and generate a list of frequent combinations of 3 items (by linking the frequent purchase of a product combination to a single item that is frequently purchased). In the above example, there is no frequent combination of 3 product combinations. The most common combinations of 3 items are {1,2,4} and {2,3,4}, but their purchase count is 2, which is lower than the minimum number of purchases we set.

Limitations of the algorithm

Therefore, some inefficiencies and tradeoffs in the Apriori algorithm also lead to many other algorithms, such as the fp-growth algorithm. The candidate set generation process generates a large number of subsets (prior algorithms always try to load as many candidate sets as possible before each scan of the database). And the bottom-up subset of the browse process (which is essentially a subset of width-first traversal) is also done until all {\displaystyle 2^{| are traversed s|} -1} A possible subset to find any maximum subset S.

Prior algorithm (Apriori algorithm)-Machine learning 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.