https://github.com/jmpotato/fp-growth-rs
An implementation of the FP-Growth algorithm in pure Rust.
https://github.com/jmpotato/fp-growth-rs
data-mining fp-growth rust
Last synced: over 1 year ago
JSON representation
An implementation of the FP-Growth algorithm in pure Rust.
- Host: GitHub
- URL: https://github.com/jmpotato/fp-growth-rs
- Owner: JmPotato
- License: mit
- Created: 2021-03-25T16:37:20.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-04-20T10:12:23.000Z (over 5 years ago)
- Last Synced: 2025-03-01T04:49:06.922Z (over 1 year ago)
- Topics: data-mining, fp-growth, rust
- Language: Rust
- Homepage: https://crates.io/crates/fp-growth
- Size: 23.4 KB
- Stars: 16
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fp-growth-rs
[](https://crates.io/crates/fp-growth)
[](https://docs.rs/fp-growth)
An implementation of the FP-Growth algorithm in pure Rust, which is inspired by [enaeseth/python-fp-growth](https://github.com/enaeseth/python-fp-growth).
## Usage
Add this to your `Cargo.toml`:
```toml
[dependencies]
fp-growth = "0.1"
```
## Example
```rust
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](LICENSE) for details.