Utility Algorithms

FSFC also has some utility algorithms which can also be useful. They may be imported from algorithm’s module, or directly from fsfc.utils module

Apriori algorithm

fsfc.utils.apriori.apriori(dataset, minspan)[source]

Apriori algorithm by Rakesh Agrawal and Ramakrishnan Srikant

Finds all frequent itemsets in the dataset with specified minspan. Itemset is a set of elements which appears in not less that minspan-part of the dataset.

Based on the article “Fast algorithms for mining association rules.”.

Parameters:
dataset: list

List of size n_samples whose elements are sets of integers. Each set represents a sample from the dataset.

minspan: float

MinSpan value. Algorithm will select sets of items that appear in not less than (MinSpan * n_samples) samples.

Returns:
itemsets: list

List of frequent itemsets. Every itemset is a list of integers in increasing order.