Skip to content

Hawmex/apriori

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Association Rule Learning with Apriori

This repository contains a command-line application written in Dart that uncovers the association rules within a list of transactions.

Getting Started

Install the Application

cd ..
dart pub global activate apriori -s=path

Prepare Input Files

You need to prepare two files:

  • A JSON file containing your transactions
  • A JSON file containing your settings and preferences

Transactions Scheme

type Transactions = string[][];

Options Scheme

type Options = {
  transactionsPath: string;
  rulesPath: string;
  minSupport: number;
  minConfidence: number;
  maxAntecedentsLength: number;
};

Run the Application

You can run the application using the following command:

apriori options.json

Example

transactions.json

[
  ["tropical fruit", "yogurt", "coffee"],
  ["whole milk"],
  ["pip fruit", "yogurt", "cream cheese", "meat spreads"]
]

options.json

{
  "transactionsPath": "transactions.json",
  "rulesPath": "rules.json",
  "minSupport": 0.006,
  "minConfidence": 0.07
}

Learning the Association Rules

apriori options.json

You can look at example/ for more information.

Performance

This application can extract and learn the association rules within the transactions at example/ in ~55 seconds.