Cpp ML Library  1.0.0
A library of Machine Learning Algorithmns seen from the Udemy course Machine Learning A to Z.
Public Member Functions | List of all members
Apriori Class Reference

Class to perform frequent itemset mining using the Apriori algorithm. More...

#include <Apriori.hpp>

Public Member Functions

 Apriori (double min_support)
 Constructor for the Apriori class. More...
 
std::vector< std::set< int > > run (const std::vector< std::vector< int >> &transactions)
 Runs the Apriori algorithm on the provided dataset. More...
 
std::unordered_map< std::string, int > get_support_counts () const
 Gets the support counts for all frequent itemsets found. More...
 
std::string itemset_to_string (const std::set< int > &itemset) const
 Converts an itemset to a string representation for use as a key. More...
 

Detailed Description

Class to perform frequent itemset mining using the Apriori algorithm.

Constructor & Destructor Documentation

◆ Apriori()

Apriori::Apriori ( double  min_support)

Constructor for the Apriori class.

Parameters
min_supportMinimum support threshold (as a fraction between 0 and 1).

Member Function Documentation

◆ get_support_counts()

std::unordered_map< std::string, int > Apriori::get_support_counts ( ) const

Gets the support counts for all frequent itemsets found.

Returns
An unordered_map where keys are itemsets (as strings) and values are support counts.

◆ itemset_to_string()

std::string Apriori::itemset_to_string ( const std::set< int > &  itemset) const

Converts an itemset to a string representation for use as a key.

Parameters
itemsetThe itemset to convert.
Returns
A string representation of the itemset.

◆ run()

std::vector< std::set< int > > Apriori::run ( const std::vector< std::vector< int >> &  transactions)

Runs the Apriori algorithm on the provided dataset.

Parameters
transactionsA vector of transactions, each transaction is a vector of items.
Returns
A vector of frequent itemsets, where each itemset is represented as a set of items.

The documentation for this class was generated from the following file: