#data-mining #pure #algorithm #growth #fp

fp-growth

纯Rust实现的FP-Growth算法

5个版本

0.1.6 2021年4月20日
0.1.4 2021年4月2日
0.1.2 2021年3月30日

#1313 in 算法

自定义许可证

27KB
502

fp-growth-rs

Crates.io docs.rs

纯Rust实现的FP-Growth算法,受enaeseth/python-fp-growth的启发。

用法

将此添加到你的 Cargo.toml

[dependencies]
fp-growth = "0.1"

示例

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);
    }
}

许可证

fp-growth-rs 在MIT许可证下分发。

有关详细信息,请参阅LICENSE

无运行时依赖