pm4py.algo.transformation.trace_encodings.algorithm module#
PM4Py – A Process Mining Library for Python Copyright (C) 2026 Process Intelligence Solutions GmbH
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see this software project’s root or visit <https://www.gnu.org/licenses/>.
Website: https://processintelligence.solutions Contact: info@processintelligence.solutions
- class pm4py.algo.transformation.trace_encodings.algorithm.Variants(*values)[source]#
Bases:
Enum- ALIGNMENTS = <module 'pm4py.algo.transformation.trace_encodings.variants.alignments' from '/home/javert/ALE/pm4py/pm4py/algo/transformation/trace_encodings/variants/alignments.py'>#
- BERT = <module 'pm4py.algo.transformation.trace_encodings.variants.bert' from '/home/javert/ALE/pm4py/pm4py/algo/transformation/trace_encodings/variants/bert.py'>#
- COUNT2VEC = <module 'pm4py.algo.transformation.trace_encodings.variants.count2vec' from '/home/javert/ALE/pm4py/pm4py/algo/transformation/trace_encodings/variants/count2vec.py'>#
- DOC2VEC = <module 'pm4py.algo.transformation.trace_encodings.variants.doc2vec' from '/home/javert/ALE/pm4py/pm4py/algo/transformation/trace_encodings/variants/doc2vec.py'>#
- EVENT_BASED = <module 'pm4py.algo.transformation.trace_encodings.variants.event_based' from '/home/javert/ALE/pm4py/pm4py/algo/transformation/trace_encodings/variants/event_based.py'>#
- CASES_TRANSFORMERS = <module 'pm4py.algo.transformation.trace_encodings.variants.cases_transformers' from '/home/javert/ALE/pm4py/pm4py/algo/transformation/trace_encodings/variants/cases_transformers.py'>#
- EVENTS_TRANSFORMERS = <module 'pm4py.algo.transformation.trace_encodings.variants.events_transformers' from '/home/javert/ALE/pm4py/pm4py/algo/transformation/trace_encodings/variants/events_transformers.py'>#
- N_GRAMS = <module 'pm4py.algo.transformation.trace_encodings.variants.n_grams' from '/home/javert/ALE/pm4py/pm4py/algo/transformation/trace_encodings/variants/n_grams.py'>#
- ONE_HOT = <module 'pm4py.algo.transformation.trace_encodings.variants.one_hot' from '/home/javert/ALE/pm4py/pm4py/algo/transformation/trace_encodings/variants/one_hot.py'>#
- TRACE_BASED = <module 'pm4py.algo.transformation.trace_encodings.variants.trace_based' from '/home/javert/ALE/pm4py/pm4py/algo/transformation/trace_encodings/variants/trace_based.py'>#
- TEMPORAL = <module 'pm4py.algo.transformation.trace_encodings.variants.temporal' from '/home/javert/ALE/pm4py/pm4py/algo/transformation/trace_encodings/variants/temporal.py'>#
- TEMPORAL_LAZY = <module 'pm4py.algo.transformation.trace_encodings.variants.temporal_lazy' from '/home/javert/ALE/pm4py/pm4py/algo/transformation/trace_encodings/variants/temporal_lazy.py'>#
- TF_IDF = <module 'pm4py.algo.transformation.trace_encodings.variants.tf_idf' from '/home/javert/ALE/pm4py/pm4py/algo/transformation/trace_encodings/variants/tf_idf.py'>#
- TOKEN_REPLAY = <module 'pm4py.algo.transformation.trace_encodings.variants.token_replay' from '/home/javert/ALE/pm4py/pm4py/algo/transformation/trace_encodings/variants/token_replay.py'>#
- WORD2VEC = <module 'pm4py.algo.transformation.trace_encodings.variants.word2vec' from '/home/javert/ALE/pm4py/pm4py/algo/transformation/trace_encodings/variants/word2vec.py'>#
- pm4py.algo.transformation.trace_encodings.algorithm.apply(log: EventLog | DataFrame | EventStream, variant: Any = Variants.TRACE_BASED, parameters: Dict[Any, Any] | None = None) Tuple[Any, List[str]][source]#
Encodes traces from a log object.
- Parameters:
log – Event log
variant – Variant of the feature extraction to use:
Variants.ALIGNMENTS => encodes Petri-net alignment diagnostics
Variants.BERT => embeds trace sentences using sentence-transformers
Variants.COUNT2VEC => counts trace token occurrences using scikit-learn
Variants.DOC2VEC => embeds traces as gensim Doc2Vec document vectors
Variants.EVENT_BASED => extracts, for each trace, a list of numerical vectors containing for each event the corresponding features
Variants.CASES_TRANSFORMERS => computes sentence-transformer embeddings at the case level
Variants.EVENTS_TRANSFORMERS => computes sentence-transformer embeddings at the event level
Variants.N_GRAMS => counts contiguous trace token n-grams using scikit-learn
Variants.ONE_HOT => extracts binary trace token occurrence vectors using scikit-learn
Variants.TRACE_BASED => extracts for each trace a single numerical vector containing the features of the trace
Variants.TEMPORAL => extracts temporal features from the traditional event log
Variants.TEMPORAL_LAZY => extracts temporal features from a Polars LazyFrame
Variants.TF_IDF => weights trace tokens/n-grams using scikit-learn TF-IDF
Variants.TOKEN_REPLAY => encodes token-replay diagnostics
Variants.WORD2VEC => aggregates gensim Word2Vec token vectors per trace
- Returns:
data – Data to provide for decision tree learning
feature_names – Names of the features, in order