An implementation of the FP-Growth algorithm in pure Rust.

Overview

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.

You might also like...
Pure Rust implementation of the Leighton Micali Signature scheme.

Leighton-Micali Hash-Based Signatures LMS implementation in Rust according to the IETF RFC 8554. This implementation is binary compatible with the ref

 A pure-Rust implementation of Bulletproofs using Ristretto.
A pure-Rust implementation of Bulletproofs using Ristretto.

Bulletproofs The fastest Bulletproofs implementation ever, featuring single and aggregated range proofs, strongly-typed multiparty computation, and a

In addition to encryption library, pure RUST implementation of SSH-2.0 client protocol

In addition to encryption library, pure RUST implementation of SSH-2.0 client protocol

Pure Rust implementation of components of the Secure Shell (SSH) protocol

RustCrypto: SSH Pure Rust implementation of components of the Secure Shell (SSH) protocol. Crates Name crates.io Docs Description ssh—encoding Decoder

An ECDSA threshold signature algorithm implemented in Rust.
An ECDSA threshold signature algorithm implemented in Rust.

Open TSS This project is a Rust implementation of multi-party {t,n}-threshold signature scheme(TSS). The current version of this library supports ECDS

A simple and secure rust command-line tool to protect your text by encrypting and decrypting it using the robust AES-256 algorithm.

Secret Keeper A simple and secure command-line tool to protect your text by encrypting and decrypting it using the robust AES-256 algorithm. Built wit

A fast, non-cryptographic, minimally DoS-resistant hashing algorithm for Rust.
A fast, non-cryptographic, minimally DoS-resistant hashing algorithm for Rust.

Foldhash This repository contains foldhash, a fast, non-cryptographic, minimally DoS-resistant hashing algorithm implemented in Rust designed for comp

Project Masterpass is a deterministic databaseless key management algorithm, aimed to help those who cannot protect their encryption keys in storage

Project Masterpass (working title) Attention! This project is still under heavy development, and SHOULD NOT be used in practice, as the algorithms cou

Standing watch over the Pi Network, PiSentinel is a consensus algorithm that safeguards security, decentralization, and scalability.

pi-sentinel Standing watch over the Pi Network, PiSentinel is a consensus algorithm that safeguards security, decentralization, and scalability. Intro

Comments
  • Get confidence numbers

    Get confidence numbers

    Is it possible somehow with this library to get the confidence numbers? For example this python library allows you to set the minimal confidence and also gives back how high the confidence was https://github.com/chonyy/fpgrowth_py

    EDIT: pyspark also has this feature https://spark.apache.org/docs/latest/ml-frequent-pattern-mining.html https://spark.apache.org/docs/latest/api/python/reference/api/pyspark.ml.fpm.FPGrowth.html

    opened by flip111 1
Owner
JmPotato
Undergraduate @BUPT, @pingcap intern, previously @bytedance @aws. Founder of @brupst.
JmPotato
Hindley–Milner Algorithm J implementation in Rust.

Algorithm J Hindley–Milner Algorithm J implementation in Rust. Showcase Usage To run the repl, use the following command: $ cargo run If you want to t

Miguel Gomes 5 Feb 21, 2024
Reference implementation for the Poseidon Snark-friendly Hash algorithm.

Dusk-Poseidon Reference implementation for the Poseidon Hashing algorithm. Reference Starkad and Poseidon: New Hash Functions for Zero Knowledge Proof

Dusk Network 96 Jan 2, 2023
An implementation of Jakobsson's Fractal Hash Sequence Traversal algorithm

fractal-hash-traversal An implementation of Jakobsson's Fractal Hash Sequence Traversal algorithm. There is at least one hash traversal algorithm that

Dan Cline 1 Jan 12, 2022
An implementation of the Gillespie algorithm.

gillrocky An implementation of the Gillespie algorithm in Rust. Example cargo build cargo run @todo See also Animated demo of algorithm References E

Justin Bradford 1 Apr 14, 2022
🚣‍♀️ <1kloc, well-documented Raft consensus algorithm implementation

miniraft A <1kloc, well-documented Raft consensus algorithm implementation This crate is a minimal implementation of the Raft consensus protocol with

Jacky Zhao 25 Dec 1, 2022
A (mostly) pure-Rust implementation of various cryptographic algorithms.

Rust-Crypto A (mostly) pure-Rust implementation of various common cryptographic algorithms. Rust-Crypto seeks to create practical, auditable, pure-Rus

null 1.2k Dec 27, 2022
A pure-Rust implementation of group operations on Ristretto and Curve25519

curve25519-dalek A pure-Rust implementation of group operations on Ristretto and Curve25519. curve25519-dalek is a library providing group operations

dalek cryptography 611 Dec 25, 2022
A prototype implementation of the Host Identity Protocol v2 for bare-metal systems, written in pure-rust.

Host Identity Protocol for bare-metal systems, using Rust I've been evaluating TLS replacements in constrained environments for a while now. Embedded

null 31 Dec 12, 2022
A pure-Rust implementation of various threshold secret sharing schemes

Threshold Secret Sharing Efficient pure-Rust library for secret sharing, offering efficient share generation and reconstruction for both traditional S

Snips 137 Dec 29, 2022
Pure Rust implementation of the RNCryptor cryptographic format by Rob Napier

rncryptor Rust Implementation of the RNCryptor spec This library implements the specification for the RNCryptor encrypted file format by Rob Napier. d

null 7 Jun 29, 2022