fp-growth

Crates.iofp-growth
lib.rsfp-growth
version0.1.6
sourcesrc
created_at2021-03-27 05:07:06.521164
updated_at2021-04-20 10:12:56.922366
descriptionAn implementation of the FP-Growth algorithm in pure Rust
homepagehttps://github.com/JmPotato/fp-growth-rs
repositoryhttps://github.com/JmPotato/fp-growth-rs
max_upload_size
id374080
size28,807
JmPotato (JmPotato)

documentation

README

fp-growth-rs

Crates.io docs.rs

An implementation of the FP-Growth algorithm in pure Rust, which is inspired by enaeseth/python-fp-growth.

Usage

Add this to your Cargo.toml:

[dependencies]
fp-growth = "0.1"

Example

use fp_growth::algorithm::FPGrowth;

fn main() {
    let transactions = vec![
        vec!["e", "c", "a", "b", "f", "h"],
        vec!["a", "c", "g"],
        vec!["e"],
        vec!["e", "c", "a", "g", "d"],
        vec!["a", "c", "e", "g"],
        vec!["e"],
        vec!["a", "c", "e", "b", "f"],
        vec!["a", "c", "d"],
        vec!["g", "c", "e", "a"],
        vec!["a", "c", "e", "g"],
        vec!["i"],
    ];
    let minimum_support = 2;
    let fp_growth_str = FPGrowth::<&str>::new(transactions, minimum_support);

    let result = fp_growth_str.find_frequent_patterns();
    println!("The number of results: {}", result.frequent_patterns_num());
    for (frequent_pattern, support) in result.frequent_patterns().iter() {
        println!("{:?} {}", frequent_pattern, support);
    }
}

License

fp-growth-rs is distributed under the terms of the MIT license.

See LICENSE for details.

Commit count: 12

cargo fmt