Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 15, 2023
commit 95d4ca8da8680aaf79c72b736b989d19b7852d7f
28 changes: 14 additions & 14 deletions machine_learning/apriori_algorithm.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
"""
Apriori Algorithm is a Association rule mining technique,
also known as market basket analysis,
aims to discover interesting relationships or associations
among a set of items in a transactional or relational database.

For example, Apriori Algorithm state:
"If a customer buys item A and item B,
then they are likely to buy item C."
This rule suggests a relationship between items A, B, and C,
indicating that customers who purchased A and B are more
Apriori Algorithm is a Association rule mining technique,
also known as market basket analysis,
aims to discover interesting relationships or associations
among a set of items in a transactional or relational database.

For example, Apriori Algorithm state:
"If a customer buys item A and item B,
then they are likely to buy item C."
This rule suggests a relationship between items A, B, and C,
indicating that customers who purchased A and B are more
likely to purchase item C as well.

WIKI: https://en.wikipedia.org/wiki/Apriori_algorithm
Expand All @@ -21,8 +21,8 @@ def load_data() -> list[list[str]]:
Returns a sample transaction dataset.

>>> load_data()
[['milk', 'bread'], ['milk', 'butter'], ['milk', 'bread', 'nuts'],
['milk', 'bread', 'chips'], ['milk', 'butter', 'chips'],
[['milk', 'bread'], ['milk', 'butter'], ['milk', 'bread', 'nuts'],
['milk', 'bread', 'chips'], ['milk', 'butter', 'chips'],
['milk', 'bread', 'butter', 'cola'], ['nuts', 'bread', 'butter', 'cola'],
['bread', 'butter', 'cola', 'ice'], ['bread', 'butter', 'cola', 'ice', 'bun']]
"""
Expand Down Expand Up @@ -68,8 +68,8 @@ def prune(
# Prune candidate itemsets
"""
The goal of pruning is to filter out candidate itemsets that are not frequent.
This is done by checking if all the (k-1) subsets of a candidate itemset
are present in the frequent itemsets of the previous iteration
This is done by checking if all the (k-1) subsets of a candidate itemset
are present in the frequent itemsets of the previous iteration
(valid subsequences of the frequent itemsets from the previous iteration).

Prunes candidate itemsets that are not frequent.
Expand Down