.. index:: single: sequential_pattern_mining_common
.. _sequential_pattern_mining_common/0:

.. rst-class:: right

**category**

``sequential_pattern_mining_common``
====================================

Shared predicates for sequential pattern miner dataset validation, support counting, and pattern ordering helpers.

| **Availability:** 
|    ``logtalk_load(sequential_pattern_mining_protocols(loader))``

| **Author:** Paulo Moura
| **Version:** 1:0:0
| **Date:** 2026-04-29

| **Compilation flags:**
|    ``static``


| **Extends:**
|    ``public`` :ref:`pattern_miner_common <pattern_miner_common/0>`
| **Uses:**
|    :ref:`list <list/0>`
|    :ref:`type <type/0>`

| **Remarks:**
|    (none)

| **Inherited public predicates:**
|     :ref:`options_protocol/0::check_option/1`  :ref:`options_protocol/0::check_options/1`  :ref:`pattern_miner_protocol/0::check_pattern_miner/1`  :ref:`options_protocol/0::default_option/1`  :ref:`options_protocol/0::default_options/1`  :ref:`pattern_miner_protocol/0::diagnostic/2`  :ref:`pattern_miner_protocol/0::diagnostics/2`  :ref:`pattern_miner_protocol/0::export_to_clauses/4`  :ref:`pattern_miner_protocol/0::export_to_file/4`  :ref:`pattern_miner_protocol/0::mine/2`  :ref:`pattern_miner_protocol/0::mine/3`  :ref:`options_protocol/0::option/2`  :ref:`options_protocol/0::option/3`  :ref:`pattern_miner_protocol/0::pattern_miner_options/2`  :ref:`pattern_miner_protocol/0::print_pattern_miner/1`  :ref:`options_protocol/0::valid_option/1`  :ref:`options_protocol/0::valid_options/1`  :ref:`pattern_miner_protocol/0::valid_pattern_miner/1`  

.. contents::
   :local:
   :backlinks: top

Public predicates
-----------------

(no local declarations; see entity ancestors if any)

Protected predicates
--------------------

.. index:: check_sequences/4
.. _sequential_pattern_mining_common/0::check_sequences/4:

``check_sequences/4``
^^^^^^^^^^^^^^^^^^^^^

Validates the collected dataset sequences and returns the maximum total sequence length.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``check_sequences(Dataset,ItemDomain,Sequences,MaxSequenceLength)``
| **Mode and number of proofs:**
|    ``check_sequences(+object_identifier,+list(atom),+list(pair(integer,list(list(atom)))),-integer)`` - ``one``


------------

.. index:: pattern_length/2
.. _sequential_pattern_mining_common/0::pattern_length/2:

``pattern_length/2``
^^^^^^^^^^^^^^^^^^^^

Computes the total number of items in a sequential pattern.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``pattern_length(Pattern,PatternLength)``
| **Mode and number of proofs:**
|    ``pattern_length(+list(list(atom)),-integer)`` - ``one``


------------

.. index:: sort_patterns/2
.. _sequential_pattern_mining_common/0::sort_patterns/2:

``sort_patterns/2``
^^^^^^^^^^^^^^^^^^^

Sorts sequence patterns first by total item count and then lexicographically.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``sort_patterns(Patterns0,Patterns)``
| **Mode and number of proofs:**
|    ``sort_patterns(+list(compound),-list(compound))`` - ``one``


------------

.. index:: filter_patterns/3
.. _sequential_pattern_mining_common/0::filter_patterns/3:

``filter_patterns/3``
^^^^^^^^^^^^^^^^^^^^^

Filters sequence patterns by minimum total item count.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``filter_patterns(Patterns0,MinimumPatternLength,Patterns)``
| **Mode and number of proofs:**
|    ``filter_patterns(+list(compound),+integer,-list(compound))`` - ``one``


------------

.. index:: count_items/4
.. _sequential_pattern_mining_common/0::count_items/4:

``count_items/4``
^^^^^^^^^^^^^^^^^

Accumulates support counts for a list of items.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``count_items(Items,Count,ItemCounts0,ItemCounts)``
| **Mode and number of proofs:**
|    ``count_items(+list(atom),+integer,+list(pair(atom,integer)),-list(pair(atom,integer)))`` - ``one``


------------

.. index:: select_frequent_item_supports/3
.. _sequential_pattern_mining_common/0::select_frequent_item_supports/3:

``select_frequent_item_supports/3``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Selects the item supports that satisfy the minimum support count.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``select_frequent_item_supports(ItemCounts,SupportCount,FrequentItemSupports)``
| **Mode and number of proofs:**
|    ``select_frequent_item_supports(+list(pair(atom,integer)),+integer,-list(compound))`` - ``one``


------------

.. index:: sort_item_supports/2
.. _sequential_pattern_mining_common/0::sort_item_supports/2:

``sort_item_supports/2``
^^^^^^^^^^^^^^^^^^^^^^^^

Sorts item supports lexicographically by item.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``sort_item_supports(ItemSupports0,ItemSupports)``
| **Mode and number of proofs:**
|    ``sort_item_supports(+list(compound),-list(compound))`` - ``one``


------------

.. index:: valid_sequence_patterns/2
.. _sequential_pattern_mining_common/0::valid_sequence_patterns/2:

``valid_sequence_patterns/2``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

True when the patterns are valid ``sequence_pattern(Pattern, Support)`` terms over the given item domain with positive integer supports.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``valid_sequence_patterns(ItemDomain,Patterns)``
| **Mode and number of proofs:**
|    ``valid_sequence_patterns(+list(atom),+list(compound))`` - ``zero_or_one``


------------

Private predicates
------------------

(no local declarations; see entity ancestors if any)

Operators
---------

(none)

