The likelihood \(P^{S}(x)\) of a whole sequence \(x\) is computed from the state probabilities at each position in the sequence. However, the likelihood of the first states is usually lower than at higher position due to a reduced memory available for prediction. A sequence may not appear as very likely if its first state has a low relative frequency, even if the model predicts high probabilities for the states at higher positions.
The pmine
function allows for advanced pattern mining with user defined parameters. It is controlled by the lag
and pmin
arguments. For example, by setting lag=2
and pmin=0.40
(example 1), we select all sequences with average (the geometric mean is used) state probability from position \(lag+1, \ldots, \ell\) above pmin
. Instead of considering the average state probability at positions \(lag+1, \ldots, \ell\), it is also possible to select frequent patterns that do not contain any state with probability below the threshold. This prevents from selecting sequences having many states with high probability but one ore several states with a low probability.
It is also possible to mine the sequence data for frequent patterns of length \(\ell_{j} < \ell\), regardless of the position in the sequence where they occur. By using the output="patterns"
argument, the pmine
function returns the patterns (as a sequence object) instead of the whole set of distinct sequences containing the patterns. Since the probability of a pattern can be different depending on the context (previous states) the returned subsequences also contain the context preceding the pattern. For more details, see Gabadinho 2016.