<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta>
      <journal-title-group>
        <journal-title>November</journal-title>
      </journal-title-group>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>A Scikit-learn Extension Dedicated to Process Mining Purposes (Extended Abstract)</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Rafael Seidi Oyamada</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Gabriel Marques Tavares</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Sylvio Barbon Junior</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Paolo Ceravolo</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>University of Milan</institution>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2023</year>
      </pub-date>
      <volume>3</volume>
      <issue>2023</issue>
      <fpage>0000</fpage>
      <lpage>0002</lpage>
      <abstract>
        <p>This demo paper presents an extension of the Scikit-learn library tailored for Process Mining applications. By integrating Process Mining capabilities into the well-known Scikit-learn, this work enables the establishment of standardized preprocessing procedures and learning workflows for researchers and practitioners. The significance of this library stems from the unaddressed challenge of reproducibility within the Process Mining community, coupled with the absence of benchmarking resources. The library is publicly accessible on GitHub, facilitating widespread adoption and collaboration in the field: https://github.com/raseidi/skpm.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;Process Mining</kwd>
        <kwd>Scikit-learn</kwd>
        <kwd>Machine Learning</kwd>
        <kwd>Predictive Monitoring</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>In the realm of process mining (PM), a research discipline characterized by its unique reliance
on event data, the absence of a standardized library for conducting machine learning (ML)
experiments has been a persistent challenge. This lack of dedicated tooling has given rise to a
problem of ineficiency and reproducibility limitations. Given the distinctive nature of process
data, conventional ML libraries often fail to provide the requisite flexibility and functionality
required for efective experimentation in this domain.</p>
      <p>The primary objective of this paper is to address this longstanding issue by proposing an
extension to the widely recognized Scikit-learn library tailored specifically to the demands of
process mining. Scikit-learn, renowned for its versatility and user-friendly application
programming interface (API), has emerged as a foundation in the ML community, empowering
researchers to construct intricate pipelines, ensuring reproducibility, and facilitating
comprehensive benchmarking.</p>
      <p>In light of this motivation, our endeavor seeks to bridge the gap between the demands of
process mining and the capabilities of a mature and well-established ML library. In doing so,
we aim to enhance the accessibility and eficiency of ML experiments within the PM domain,
ultimately contributing to the advancement of this research field. In the subsequent sections
of this paper, we will delve into the specifics of our proposed extension, describe its design
and functionalities, and present a few use cases for predicting the remaining time and the next
activity of processes.</p>
      <p>The paper is organized as follows: we motivate and discuss existing tools in Section 2, describe
the proposed implementation in Section 3 followed by a brief use can in Section 4. We conclude
and discuss future research in Section 5.</p>
    </sec>
    <sec id="sec-2">
      <title>2. Tool Motivation</title>
      <p>
        Within the domain of PM, where the unique characteristics of the data demand specialized
attention, there exists a need for a dedicated ML library to facilitate the essential aspects of
reproducibility and benchmarking. The data usually consists of an event log, which is a set
of process instances (cases/traces), where a process instance is an ordered sequence of events.
Each event is represented by at least a case identifier (it identifies to which process instance the
event belongs), a timestamp (remarking when the event was executed), and an activity label
(remarking the action that represents the event, for instance, Create process or Conclude process).
This nature of data, which is commonly collected from large information systems, requires
specific preprocessing steps for ML purposes which usually consist of extracting temporal
feature representations, mapping resource usage, and measuring process costs [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ].
      </p>
      <p>
        Existing tools, including generic PM software (e.g., ProM1[
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], Apromore2[
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], and pm4py3[
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]),
process analytics tools (e.g., DyLo4[
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]), and comprehensive surveys ofering open-source access
to their experimental setups [
        <xref ref-type="bibr" rid="ref6 ref7">6, 7</xref>
        ], while valuable resources, do not fulfill the role of dedicated
tools for practical ML application and extensibility. The benchmarks commonly employed are
static in nature and present challenges when it comes to extensibility and adaptation. The
wellknown pm4py may be considered the most popular tool for managing event logs. Although the
library has a module dedicated to ML, it is limited to a few simple feature engineering/extraction
solutions. Thus, in the end, the design of ML pipelines consisting of tuning for both preprocessing
and training steps is not supported, i.e., is left to the user. Our innovative proposal streamlines
ML pipelines for PM, coupling all necessary steps in a single tool, reducing practitioner efort.
      </p>
      <p>
        Within process mining, a popular field that employs learned solutions is called Predictive
Process Monitoring [
        <xref ref-type="bibr" rid="ref6 ref7">6, 7</xref>
        ] and it had a huge increase of publications in the past few years. The
motivation for our work becomes evident when considering the existing benchmark practices.
While these benchmarks utilize the core methods of Scikit-learn and pm4py, the incorporation
of essential elements for constructing ML pipelines tailored to PM objectives necessitates
significant overhead. This eventually results in the reliance on external libraries beyond
Scikit1https://promtools.org/
2https://apromore.com/
3https://pm4py.fit.fraunhofer.de/static/assets/api/2.7.5.1/index.html
4https://github.com/BrechtWts/DyLoPro
learn, introducing complexities in terms of maintenance, reproducibility, and adaptability as
these external dependencies may quickly become outdated.
      </p>
    </sec>
    <sec id="sec-3">
      <title>3. Design and Implementation</title>
      <p>This section presents technical details. First, we present an overview of how to extend
Scikitlearn. Second, we discuss how PM-related features/steps might be included under the Scikit-learn
API.</p>
      <p>Scikit-learn Overview. In summary, the Scikit-learn API involves the following fundamental
steps: firstly, the instantiation of an estimator or transformer; secondly, the fitting of the object
instance to acquire knowledge from the input data set; and finally, the prediction process if
the object serves as a predictor, such as a random forest, or the transformation process if the
object is intended to modify the data in a certain manner. From the oficial documentation, we
summarize the main characteristics of the library below.</p>
      <p>• Instantiation. The __init__() should contain arguments that determine the
estimator’s behavior. More specifically, only tunable hyperparameters should be included here.
This is important in more complex applications, for instance when performing grid search,
to diferentiate the hyperparameters from attributes. No logic nor validation should be
implemented here.
• Fitting. The fit() method takes the training data as an argument, which can be just
one array if it is an unsupervised problem or a data transformation; or two arrays if
it is a supervised learning scenario. Additionally, it accepts optional data-dependent
parameters.
• Predicting or Transforming. If fit() succeeds, it will estimate parameters from
the data (e.g., the mean and standard deviation for z-score normalization). Finally, the
methods predict() or transform() can be called, depending on the nature of the
estimator.</p>
      <p>Extending Scikit-learn for Process Mining. Following the specified criteria, we formulate
a Scikit-learn extension for PM by utilizing its core methods for standardizing ML experiments
in the PM community. In this initial work, our focus centers on the event attributes, including
the case identifier, timestamp, activity, and categorical resources.</p>
      <p>
        For activity representation, we employ one-hot encoding, aligning with the prevalent practice
in the PM community, as indicated by prior research [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ], despite recent findings suggesting
superior performance with alternative encoding methods [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]. Concerning timestamp-related
feature extraction, our library accounts for both the case identifier and the timestamp to
ensure proper attribution of events to their respective process instances, especially when
calculating time-based metrics such as the time diference between consecutive events ( − 1
and ). Additionally, while categorical resource attributes (e.g. actors playing events) can be
one-hot encoded, our library also ofers an alternative organizational mining algorithm for
role discovery [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]. This algorithm identifies common roles among actors, facilitating resource
grouping and reducing category dimensionality.
      </p>
      <p>When instantiating our estimators, users have the flexibility to specify parameters such
as the time-related features to extract from timestamps and the sensitivity threshold for the
role discovery algorithm. During the fit method invocation, users must provide the column
names corresponding to each required event attribute for a given estimator. By meticulously
designing each estimator for event feature extraction, we seamlessly integrate them into the
well-established Scikit-learn pipelines and model selection algorithms. In the subsequent section,
we illustrate a practical use case by constructing a concise pipeline using our proposed library.</p>
    </sec>
    <sec id="sec-4">
      <title>4. Use cases</title>
      <p>Our work is under continuous development and we are already able to perform a complete
pipeline involving preprocessing and prediction. In this section, we introduce a pipeline for
remaining time prediction and demonstrate it in a video record5.</p>
      <p>We have implemented two feature extractors, one for timestamps and another for
categorical resources, and tested them on public event logs (see our repository). The class
TimestampExtractor has only one argument features that describes all the features that
should be extracted from the timestamp. These time-related features were collected from the
literature and they currently include execution_time, accumulated_time, within_day,
and remaining_time. The latter is commonly employed as a target to be predicted. Regarding
the categorical resources, we have implemented the resource role discovery as mentioned in
the previous section, which in a nutshell aggregates common resources into groups (roles in
the organization), hence reducing the set of available categorical values. This algorithm has a
hyperparameter that is used as a relationship threshold, which can be seen as a threshold to
decide if resources belong or not to the same group.</p>
      <p>
        That said, we can instantiate a Scikit-learn pipeline as illustrated in Figure1. For activity
encoding, we simply use the traditional one-hot encoding. The timestamp can have all the
implemented features extracted in order to increase the knowledge space, and normalized
subsequently. The resource has its set of unique and individual labels reduced to roles (a.k.a. pool).
Lastly, the case identifier needs to be passed through, i.e., it is fed to the ColumnTransformer and
should not be dropped (default operation in Scikit-learn) in order to be used in the next step. The
TraceAggregator is a trace encoding technique described in [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] which consists of aggregating
the previous events of an ongoing case in order to output a single array. This aggregation
considers averaging or summing all the knowledge up. Finally, a random forest or any other
learning algorithm can be employed. In our example, we illustrate the RandomForestRegressor
since we are predicting the remaining time of ongoing cases. The reader is able to run the
pipeline by following the instructions in our repository.
      </p>
    </sec>
    <sec id="sec-5">
      <title>5. Conclusion and discussion</title>
      <p>In this paper, we present an initial iteration of SkPM, a specialized ML library tailored for the
PM domain. This library focuses on the implementation of widely adopted preprocessing steps
from PM involving ML-based solutions. SkPM capitalizes on the full spectrum of functionalities
provided by the renowned Scikit-learn framework, encompassing standardization of
preprocessing steps, the construction of pipelines, and the execution of model selection procedures.
Ongoing eforts are dedicated to the continual extension of SkPM’s features, enhancements
to its usability, refinement of documentation, and the provision of tutorials. Lastly, we invite
researchers and practitioners to actively participate and contribute to SkPM’s development by
visiting our repository at https://github.com/raseidi/skpm.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>C. dos Santos</given-names>
            <surname>Garcia</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Meincheim</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E. R. F.</given-names>
            <surname>Junior</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M. R.</given-names>
            <surname>Dallagassa</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D. M. V.</given-names>
            <surname>Sato</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D. R.</given-names>
            <surname>Carvalho</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E. A. P.</given-names>
            <surname>Santos</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E. E.</given-names>
            <surname>Scalabrin</surname>
          </string-name>
          ,
          <article-title>Process mining techniques and applications - A systematic mapping study</article-title>
          ,
          <source>Expert Syst. Appl</source>
          .
          <volume>133</volume>
          (
          <year>2019</year>
          )
          <fpage>260</fpage>
          -
          <lpage>295</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>B. F. van Dongen</given-names>
            ,
            <surname>A. K. A. de Medeiros</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H. M. W.</given-names>
            <surname>Verbeek</surname>
          </string-name>
          ,
          <string-name>
            <surname>A. J. M. M. Weijters</surname>
            ,
            <given-names>W. M. P. van der Aalst</given-names>
          </string-name>
          ,
          <article-title>The prom framework: A new era in process mining tool support</article-title>
          ,
          <source>in: ICATPN</source>
          , volume
          <volume>3536</volume>
          <source>of LNCS</source>
          , Springer,
          <year>2005</year>
          , pp.
          <fpage>444</fpage>
          -
          <lpage>454</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>M. L.</given-names>
            <surname>Rosa</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H. A.</given-names>
            <surname>Reijers</surname>
          </string-name>
          ,
          <string-name>
            <surname>W. M. P. van der Aalst</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R. M.</given-names>
            <surname>Dijkman</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Mendling</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Dumas</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>García-Bañuelos</surname>
          </string-name>
          ,
          <article-title>APROMORE: an advanced process model repository</article-title>
          ,
          <source>Expert Syst. Appl</source>
          .
          <volume>38</volume>
          (
          <year>2011</year>
          )
          <fpage>7029</fpage>
          -
          <lpage>7040</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>A.</given-names>
            <surname>Berti</surname>
          </string-name>
          , S. van Zelst,
          <string-name>
            <given-names>D.</given-names>
            <surname>Schuster</surname>
          </string-name>
          ,
          <article-title>Pm4py: A process mining library for python</article-title>
          ,
          <source>Software Impacts</source>
          <volume>17</volume>
          (
          <year>2023</year>
          )
          <fpage>100556</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>B.</given-names>
            <surname>Wuyts</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Weytjens</surname>
          </string-name>
          , S. vanden Broucke,
          <string-name>
            <given-names>J. D.</given-names>
            <surname>Weerdt</surname>
          </string-name>
          ,
          <article-title>Dylopro: Profiling the dynamics of event logs</article-title>
          ,
          <source>in: BPM</source>
          , volume
          <volume>14159</volume>
          <source>of LNCS</source>
          , Springer,
          <year>2023</year>
          , pp.
          <fpage>146</fpage>
          -
          <lpage>162</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>I.</given-names>
            <surname>Teinemaa</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Dumas</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M. L.</given-names>
            <surname>Rosa</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F. M.</given-names>
            <surname>Maggi</surname>
          </string-name>
          ,
          <article-title>Outcome-oriented predictive process monitoring: Review and benchmark</article-title>
          ,
          <source>ACM Trans. Knowl. Discov. Data</source>
          <volume>13</volume>
          (
          <year>2019</year>
          )
          <volume>17</volume>
          :
          <fpage>1</fpage>
          -
          <lpage>17</lpage>
          :
          <fpage>57</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>E.</given-names>
            <surname>Rama-Maneiro</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Vidal</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Lama</surname>
          </string-name>
          ,
          <article-title>Deep learning for predictive business process monitoring: Review and benchmark</article-title>
          ,
          <source>IEEE TSC</source>
          (
          <year>2021</year>
          )
          <fpage>1</fpage>
          -
          <lpage>1</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>S. B.</given-names>
            <surname>Jr.</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Ceravolo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R. S.</given-names>
            <surname>Oyamada</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G. M.</given-names>
            <surname>Tavares</surname>
          </string-name>
          ,
          <article-title>Trace encoding in process mining: a survey and benchmarking</article-title>
          ,
          <source>CoRR abs/2301</source>
          .02167 (
          <year>2023</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>M.</given-names>
            <surname>Song</surname>
          </string-name>
          ,
          <string-name>
            <surname>W. M. P. van der Aalst</surname>
          </string-name>
          ,
          <article-title>Towards comprehensive support for organizational mining</article-title>
          ,
          <source>Decis. Support Syst</source>
          .
          <volume>46</volume>
          (
          <year>2008</year>
          )
          <fpage>300</fpage>
          -
          <lpage>317</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>