Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the cl-association-rules Reference Manual, version 0.0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Aug 15 03:28:17 2022 GMT+0.
Next: Systems, Previous: The cl-association-rules Reference Manual, Up: The cl-association-rules Reference Manual [Contents][Index]
This project aims to implement the most well known strategies and utilities when mining association rules from a dataset of transactions. For now, only the apriori algorithm is implemented. It works at least on sbcl, ecl, ccl, abcl and clisp.
This section assumes you use quicklisp. If you don't, you should! Download and learn about it here.
Once you have quicklisp loaded, simply do:
(ql:quickload :cl-association-rules)
And it's all up and running. To run the tests do:
(ql:quickload :cl-association-rules-tests)
Please report if any tests fail in your Common Lisp implementation.
To make it easier to write, the cl-association-rules package also has the nickname "rules".
> (ql:quickload :cl-association-rules)
(:CL-ASSOCIATION-RULES)
> (rules:apriori '((1 2 3 4) ;; each of these lines is a transaction
(1 2 4)
(1 2)
(2 3 4)
(2 3)
(3 4)
(2 4)))
((3) => (2). Support is 3/7 and confidence is 3/4.
(4 1) => (2). Support is 2/7 and confidence is 1.
(4) => (2). Support is 4/7 and confidence is 4/5.
(1) => (2). Support is 3/7 and confidence is 1.
(3) => (4). Support is 3/7 and confidence is 3/4.)
Apriori calculates the association rules in "dataset" using the apriori algorithm. Expects a dataset of the form ((1 2 3 4) (3 2 7 9) (9) (2 3 8) (2 0)), where each line is a transaction. You can also costumize the support (defaults to 0.17), the confidence (defaults to 0.68) and the equality operator (defaults to the lisp "equalp" function). The output is a list of mined rules, where each rule is an instance of a struct with fields posttuple, pretuple, support and confidence. This method may signal type-error.
> (defvar *mined-rules* (rules:apriori '((1 2 3 4)
(1 2 3 7)
(1 9)
(2 10 15 4)
(1 3 4 11)
(15 3 1 20))))
*MINED-RULES* ;; ((2 1) => (3). Support is 1/3 and confidence is 1.
;; (3 2) => (1). Support is 1/3 and confidence is 1.
;; (1) => (3). Support is 2/3 and confidence is 4/5.
;; (3) => (1). Support is 2/3 and confidence is 1.)
> (rules:rule-pretuple (first *MINED-RULES*))
(2 1) ;; accessing member "pretuple" of the rule struct. Other members are
;; "posttuple", "support" and "confidence".
If you have any suggestions, bug reports, etc, please fill in an issue describing it. If you have the time and want to contribute, that is even better! Submit some tests too :)
Here is what I'm thinking might make sense to implement next:
MIT
Next: Files, Previous: Introduction, Up: The cl-association-rules Reference Manual [Contents][Index]
The main system appears first, followed by any subsystem dependency.
An implementation of the apriori algorithm to mine association rules in Common Lisp.
Diogo Franco
MIT
0.0.1
Next: Packages, Previous: Systems, Up: The cl-association-rules Reference Manual [Contents][Index]
Files are sorted by type and then listed depth-first from the systems components trees.
Next: cl-association-rules/package.lisp, Previous: Lisp, Up: Lisp [Contents][Index]
cl-association-rules (system).
Next: cl-association-rules/rule.lisp, Previous: cl-association-rules/cl-association-rules.asd, Up: Lisp [Contents][Index]
cl-association-rules (system).
Next: cl-association-rules/apriori.lisp, Previous: cl-association-rules/package.lisp, Up: Lisp [Contents][Index]
package.lisp (file).
cl-association-rules (system).
Previous: cl-association-rules/rule.lisp, Up: Lisp [Contents][Index]
rule.lisp (file).
cl-association-rules (system).
apriori (function).
Next: Definitions, Previous: Files, Up: The cl-association-rules Reference Manual [Contents][Index]
Packages are listed by definition order.
rules
common-lisp.
Next: Indexes, Previous: Packages, Up: The cl-association-rules Reference Manual [Contents][Index]
Definitions are sorted by export status, category, package, and then by lexicographic order.
Next: Internals, Previous: Definitions, Up: Definitions [Contents][Index]
Next: Standalone methods, Previous: Public Interface, Up: Public Interface [Contents][Index]
Calculates the association rules in the dataset using the apriori
algorithm. Expects a dataset of the form
((1 2 3 4)
(3 2 7 9)
(9)
(2 3 8)
(2 0)),
where each line is a transaction.
Returns a list of the mined rules.
Previous: Public Interface, Up: Definitions [Contents][Index]
Next: Structures, Previous: Internals, Up: Internals [Contents][Index]
Generates the next candidate set, from the previous frequent and non-frequent itemsets.
From the frequent itemsets found by apriori, generate association rules for a given min-confidence.
From a dataset, return the unique items as a list.
From a candidate set and support threshold, return the items that are frequent and non-frequent in the dataset.
Returns t if two sets of elements are equal
Previous: Ordinary functions, Up: Internals [Contents][Index]
Previous: Definitions, Up: The cl-association-rules Reference Manual [Contents][Index]
Jump to: | (
A C F G M P R S |
---|
Jump to: | (
A C F G M P R S |
---|
Next: Data types, Previous: Functions, Up: Indexes [Contents][Index]
Jump to: | C P S |
---|
Jump to: | C P S |
---|
Jump to: | A C F P R S |
---|
Jump to: | A C F P R S |
---|