Skip to content

check_event_subsequence_containment()

check_event_subsequence_containment() tells you whether each sequence contains a target subsequence.

Function Usage

python
check_event_subsequence_containment(
    event_sequences,
    target_subsequence,
    search_constraint=None
)

TraMineR Parameter Mapping

  • event_sequences -> TraMineR eseq
  • target_subsequence -> TraMineR subseq
  • search_constraint -> TraMineR constraint

Entry Parameters

ParameterRequiredTypeDescription
event_sequences (event_sequences)EventSequenceData / EventSequenceListThe full event-sequence dataset you want to scan.
target_subsequence (target_pattern)EventSequence / strThe pattern to look for, either as an object or a string like "(A)-(B,C)".
search_constraintEventSequenceConstraintTime and counting constraints.

What It Returns

A boolean pandas Series:

  • True = subsequence appears in that sequence.
  • False = subsequence does not appear.

Example

python
contains = check_event_subsequence_containment(
    event_sequences,
    target_subsequence="(Graduate)-(FindJob)"
)

R Counterpart

  • Closest R function: seqecontain
  • Mapping note: Both functions check whether event sequences contain specified subsequence patterns. In Sequenzo, the target pattern can be provided as a string or an event-sequence object.

Authors

Code: Yuqi Liang

Documentation: Yuqi Liang

References

Ritschard, G., Bürgin, R., & Studer, M. (2013). Exploratory Mining of Life Event Histories. In J. J. McArdle & G. Ritschard (Eds.), Contemporary Issues in Exploratory Data Mining in the Behavioral Sciences (pp. 221-253). Routledge.