Warning about automatic conversion of matrices or data.frames to transactions.
It is preferred to create transactions manually before calling apriori
to have control over item coding. This is especially important when you are working with multiple datasets or several subsets of the same dataset. To read about item coding, see
itemCoding
.
If a data.frame is specified as x
, then the data is automatically converted
into transactions by discretizing numeric data using discretizeDF
and then
coercion to transactions. The discretization may fail if the data is not well behaved.
Consult the manual page for discretizeDF
for details.
Apriori only creates rules with one item in the RHS (Consequent)! The default value in '>APparameter
for minlen
is 1. This
means that rules with only one item (i.e., an empty antecedent/LHS) like
$$\{\} => \{beer\}$$
will be created.
These rules mean that no matter what other items are involved, the
item in the RHS will appear with the probability given by the rule's
confidence (which equals the support).
If you want to avoid these rules then use
the argument parameter=list(minlen=2)
.
Notes on run time and memory usage:
If the minimum support
is chosen
too low for the dataset, then the algorithm will try to
create an extremely large set of itemsets/rules. This will result in very
long run time and eventually the process will run out of memory.
To prevent this, the default maximal
length of itemsets/rules is restricted to 10 items
(via the parameter element maxlen=10
) and
the time for checking subsets is limited to 5 seconds
(via maxtime=5
). The output will show if you
hit these limits in the "checking subsets" line of the output. The
time limit is only checked when the subset size increases, so
it may run significantly longer than what you specify in maxtime.
Setting maxtime=0
disables the time limit.
Interrupting execution with Control-C/Esc is not recommended.
Memory cleanup will be prevented resulting in a memory leak. Also,
interrupts are only checked when the subset size increases, so it may take
some time till the execution actually stops.