<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Gianpio Sozzo on Medium]]></title>
        <description><![CDATA[Stories by Gianpio Sozzo on Medium]]></description>
        <link>https://medium.com/@g.sozzo?source=rss-eb148d051a43------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Gianpio Sozzo on Medium</title>
            <link>https://medium.com/@g.sozzo?source=rss-eb148d051a43------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 22:41:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@g.sozzo/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[What’s New in Apache Spark 4.0]]></title>
            <link>https://medium.com/data-reply-it-datatech/whats-new-in-apache-spark-4-0-af33d99aa3f6?source=rss-eb148d051a43------2</link>
            <guid isPermaLink="false">https://medium.com/p/af33d99aa3f6</guid>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[spark]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[data-analytics]]></category>
            <dc:creator><![CDATA[Gianpio Sozzo]]></dc:creator>
            <pubDate>Fri, 13 Sep 2024 15:09:57 GMT</pubDate>
            <atom:updated>2024-09-13T15:09:57.988Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ql2-sISw8OhVQNYe" /><figcaption>Photo by <a href="https://unsplash.com/@davealmine?utm_source=medium&amp;utm_medium=referral">Dawid Zawiła</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Since it was first developed at UC Berkeley’s AMPLab in 2009, Apache Spark has rapidly evolved to become one of the most popular tools in big data processing. Initially designed to address the limitations of Hadoop’s MapReduce, Spark introduced an in-memory processing model that improved the speed and efficiency of data analytics. Over the years, Spark has incorporated support for SQL, machine learning, graph processing, and real-time streaming, making it an indispensable tool used by companies across various industries.</p><p>With each new release, the Spark community has continued to innovate, adding features that address the needs of modern data-driven organizations. Now, with the upcoming release of <strong>Spark 4.0</strong>, more powerful features and enhancements will be introduced reflecting the continuous innovation and dedication of the Spark community.</p><p>Spark 4.0 introduces updates that can optimize workflows and boost performance. This release hosts new features aimed at improving performance, user experience, and functionality. In this article, key updates and enhancement of Spark 4.0 will be explored, including <em>Spark Connect, ANSI SQL mode, Collation</em> and much more.</p><h3>Key Highlights of Apache Spark 4.0</h3><h4><strong>Spark Connect</strong></h4><p>One of the new key updates of Spark 4.0 is <strong>Spark Connect</strong>, a new client-server protocol that allows applications to connect to Spark from any device or IDE. This new update of Spark Connect decouples the driver from the application making it as a service and allowing to easily embed Spark in IDEs (e.g. PyCharm, Jupyter) using a lightweight client.</p><p>Some of the new features of Spark Connect are:</p><ul><li><strong>Thin client</strong>: Spark Connect client is just 1.5 MB compared to the full PySpark, which is 355 MB. It is merely a Python library (there is no JVM) and it is installable via a simple pip install pyspark-connect command</li><li><strong>Cross-language support</strong>: Spark Connect enables the development of Spark applications across multiple languages like Python, Scala, Java, GO, and more.</li><li><strong>IDE integration</strong>: enables developers to interactively develop and debug directly from their IDE.</li></ul><h4>ANSI SQL Mode by Default</h4><p>Another key update in Spark 4.0 is that <strong>ANSI SQL mode</strong> is enabled by default making Spark follow SQL standards in a more consistent manner. This mode improves data integrity by ensuring that queries fail with proper error handling rather than silently proceeding with potentially corrupted data.</p><p>When a query encounters issues (e.g. division by zero or invalid casts), Spark 4.0 throws errors rather than allowing the operation to proceed improving data integrity.</p><p>When errors occur Spark will show more specific error messages, including the exact line of failure in queries, helping developers to debug errors.</p><p><strong>Example: Error handling with Spark 4.0</strong></p><pre>-- In Spark 3.x, casting a String to Integer returns NULL<br>SELECT CAST(&#39;myString&#39; AS INT);</pre><pre>| CAST(&#39;myString&#39; AS INT) |<br>| ----------------------- |<br>| NULL                    |</pre><pre>-- In Spark 4.0, the ANSI SQL mode throws an error for a not valid casting<br>SELECT CAST(&#39;myString&#39; AS INT);</pre><pre>Error: Cannot cast &#39;myString&#39; to INT</pre><h4>Variant Data Type for Semi-Structured Data</h4><p>Another useful feature introduced by Spark 4.0 is the <strong>Variant Data Type</strong>. This new data type ensures better performance when working with semi-structured data like JSON or XML allowing to query, for example, JSON fields, directly with SQL. This type reduces the overhead associated with parsing and querying semi-structured data.</p><p><strong>Example: Querying JSON Using Variant Data Type</strong></p><pre>-- Create table with VARIANT column<br>CREATE TABLE people_table (<br>  person_id INT,<br>  personal_data VARIANT<br>);</pre><pre>-- Insert JSON data<br>INSERT INTO people_table (person_id, personal_data)<br>VALUES<br>(1, PARSE_JSON(&#39;{&quot;first_name&quot;: &quot;John&quot;, &quot;last_name&quot;: &quot;Doe&quot;, &quot;address&quot;: {&quot;city&quot;: &quot;New York&quot;, &quot;zip&quot;: &quot;10001&quot;}, &quot;contacts&quot;: {&quot;email&quot;: &quot;john.doe@example.com&quot;, &quot;phone&quot;: &quot;+1-123-456-7890&quot;}}&#39;)),<br>(2, PARSE_JSON(&#39;{&quot;first_name&quot;: &quot;Jane&quot;, &quot;last_name&quot;: &quot;Smith&quot;, &quot;address&quot;: {&quot;city&quot;: &quot;Los Angeles&quot;, &quot;zip&quot;: &quot;90001&quot;}, &quot;contacts&quot;: {&quot;email&quot;: &quot;jane.smith@example.com&quot;, &quot;phone&quot;: &quot;+1-987-654-3210&quot;}}&#39;));</pre><pre>| person_id | personal_data                                      |<br>| --------- | -------------------------------------------------- |<br>| 1         | {&quot;first_name&quot;: &quot;John&quot;, &quot;last_name&quot;: &quot;Doe&quot;, ... }   |<br>| 2         | {&quot;first_name&quot;: &quot;Jane&quot;, &quot;last_name&quot;: &quot;Smith&quot;, ... } |</pre><p>Thanks to <strong>Variant Data Type</strong>, it is possible to query semi-structured data without using parsing functions as get_json_object.</p><pre>SELECT<br>  person_id,<br>  personal_data.first_name AS first_name,<br>  personal_data.last_name AS last_name,<br>  personal_data.address.city AS city<br>FROM<br>  people_table<br>WHERE<br>  personal_data.address.city = &#39;New York&#39;;</pre><pre>| person_id | first_name | last_name | city      |<br>| --------- | ---------- | --------- | --------- |<br>| 1         | John       | Doe       | New York  |</pre><h4>Collation Support for String Comparisons</h4><p>Spark 4.0 introduces Collation Support, making it easier to sort and to compare string data across different languages and case-insensitivity rules. With this support, developers can specify how strings are compared using collation rules handling both cases or accents. New collations (Unicode CI case-insensitive and Unicode_CI_AI case-insensitive and accent-insensitive) are provided for datasets with different text formats.</p><p>This feature is useful when working with datasets in different languages bringing Spark’s SQL capabilities closer to traditional relational databases.</p><p><strong>Example: Using Collation in Queries</strong></p><pre>SELECT name <br>FROM users <br>ORDER BY name COLLATE unicode_ci_ai;</pre><h4>SQL UDF/UDTF Enhancements</h4><p>With Apache Spark 4.0, SQL UDFs (User Defined Functions) and UDTFs (User Defined Table Functions) have received significant improvements allowing for more complex query logic and parameterized views.</p><p>The main enhancements introduced are the following:</p><ul><li><strong>SQL scripting with control flow</strong>: Apache Spark now supports SQL control flow, iterators, and error handling, enhancing its capabilities as a grown SQL platform.</li><li><strong>Dynamic functions</strong>: It is possible to create reusable SQL functions for more complex logic to create more dynamic and flexible SQL workflows.</li></ul><p><strong>Example: Creating and Using SQL UDTF</strong></p><pre>-- Define the UDTF to extract full name and city from the Variant data<br>CREATE FUNCTION extract_fullname_and_city(person_data VARIANT)<br>RETURNS TABLE(full_name STRING, city STRING) <br>RETURN <br>    SELECT <br>        CONCAT(person_data.first_name, &#39; &#39;, person_data.last_name) AS full_name, <br>        person_data.address.city AS city;</pre><pre>-- Query the table using the UDTF to extract full name and city<br>SELECT <br>    person_id, <br>    full_name, <br>    city <br>FROM <br>    people_table, <br>    LATERAL extract_fullname_and_city(personal_data);</pre><pre>person_id | full_name  | city        |<br>--------- | ---------- | ----------- |<br>1         | John Doe   | New York    |<br>2         | Jane Smith | Los Angeles |</pre><h4>Delta Lake 4.0 Integration</h4><p>The release of Spark 4.0 also includes support for <strong>Delta Lake 4.0</strong>, offering new features for managing large-scale data lakes. Delta Lake 4.0 introduces <strong>liquid clustering</strong> for faster reads (up to 12x) and writes (up to 7x) and simplifies operations like (auto-)compaction and table cloning. These new features make it easier to manage Delta tables in multi-cluster environments, providing better performance and consistency</p><p><strong>Example: Using Delta Lake with Liquid Clustering</strong></p><pre>OPTIMIZE delta_table CLUSTER BY (id);</pre><h4>Conclusion</h4><p>Apache Spark 4.0 brings significant improvements that significantly enhance its performance, usability, and flexibility making it faster, easier, and more flexible for big data processing. From the introduction of Spark Connect to major improvements in SQL functionality. These updates make Spark 4.0 a robust platform for data processing in large-scale environments and for the most demanding data workflows, ensuring both compatibility with existing systems and the ability to handle modern data processing needs.</p><p>By adopting Spark 4.0, organizations can be at the cutting-edge of big data technologies, capitalizing on its cutting-edge functionalities while maintaining compatibility with existing Spark workflows.</p><h4>References</h4><p>1. <strong>Tech Blog AP-COM</strong>. &quot;Apache Spark 4.0 Preview,&quot; June 2024. <a href="https://techblog.ap-com.co.jp/entry/2024/06/13/165331#Preface">https://techblog.ap-com.co.jp/entry/2024/06/13/165331#Preface</a><br>2. <strong>Apache Spark Official Documentation</strong>. &quot;Apache Spark 4.0.0-preview1 Documentation,&quot; 2024. <a href="https://spark.apache.org/docs/4.0.0-preview1/">https://spark.apache.org/docs/4.0.0-preview1/</a><br>3. <strong>Li, X., Fan, W.</strong>. &quot;What’s Next for the Upcoming Apache Spark 4.0 Release?&quot; Data + AI Summit, 2024.<br>4. <strong>Databricks</strong>. &quot;What’s Next for the Upcoming Apache Spark 4.0,&quot; Data + AI Summit, 2024. <a href="https://www.databricks.com/dataaisummit/session/whats-next-upcoming-apache-spark-40">https://www.databricks.com/dataaisummit/session/whats-next-upcoming-apache-spark-40</a><br>5. <strong>Delta.io Blog</strong>. &quot;Delta Lake 4.0,&quot; Delta.io Blog, 2024. <a href="https://delta.io/blog/delta-lake-4-0/">https://delta.io/blog/delta-lake-4-0/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=af33d99aa3f6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-reply-it-datatech/whats-new-in-apache-spark-4-0-af33d99aa3f6">What’s New in Apache Spark 4.0</a> was originally published in <a href="https://medium.com/data-reply-it-datatech">Data Reply IT | DataTech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Optimizing Garbage Collection in Apache Spark]]></title>
            <link>https://medium.com/data-reply-it-datatech/optimizing-garbage-collection-in-apache-spark-3f07d36ce8c1?source=rss-eb148d051a43------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f07d36ce8c1</guid>
            <category><![CDATA[apache-spark]]></category>
            <category><![CDATA[garbage-collection]]></category>
            <category><![CDATA[optimization]]></category>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[big-data-analytics]]></category>
            <dc:creator><![CDATA[Gianpio Sozzo]]></dc:creator>
            <pubDate>Tue, 27 Feb 2024 10:19:12 GMT</pubDate>
            <atom:updated>2024-02-27T10:19:12.351Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AE3GzHM4GyU439fWeqOCWg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@moritz_photography?utm_source=medium&amp;utm_medium=referral">Moritz Kindler</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Apache Spark has become a powerful tool for big data processing as it offers high performance and scalability. Memory management is one of the fundamental aspects in Spark applications for achieving optimal performance. As Apache Spark relies on Java Virtual Machine, tuning Java garbage collection (GC) will be examined providing strategies for optimizing performance.</p><h4><strong>Understanding Garbage Collection in Java</strong></h4><p>Garbage collection is a critical aspect of memory management in Java. It automates the process of reclaiming memory occupied by objects that are no longer needed. This feature prevents memory leaks and ensures efficient memory utilization within Java applications. To optimize the performance of applications is essential to understand the complexities of garbage collection in Java. This allows to be in control to memory management, such as heap sizing and GC tuning parameters to effectively fine-tuning Java applications to have better performance and scalability.</p><p>Java heap space is divided into two regions:</p><ul><li><strong>Young</strong>, in which object with a short life lies and it is, in turn, divided into three regions (<strong>Eden</strong>, <strong>Survivor1</strong> <strong>(S1)</strong> and <strong>Survivor2 (S2)</strong>).</li><li><strong>Old</strong>, in which object with a longer life lies.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/991/1*L92lb0UGfqcTZoCbI1Bdtw.png" /><figcaption>Java heap space</figcaption></figure><p>When the Eden region is full objects that live into Eden and Survivor1 are copied into Survivor2 and then the S1 and S2 are swapped. Objects are moved into the Old regions only if S2 is full or they are old enough. As the last step, the Garbage Collection is invoked when the Old regions is nearly full.</p><p>The goal of Garbage Collection in Spark is to ensure that the Old region contains only the long-lived objects and that the Young generation stores all the short-lived objects.</p><h4><strong>Garbage Collection challenges in Apache Spark</strong></h4><p>Apache Spark is a distributed computing framework for processing large datasets across clusters. Achieving optimal performance in Spark applications extends beyond its distributed architecture. As Apache Spark relies on Java Virtual Machine, this requires to understand how garbage collection operates within the JVM so that developers can effectively optimize Spark applications for enhanced performance and scalability. This is done by fine-tuning garbage collection settings and optimizing memory management strategies thus unlocking the potential of Spark.</p><p>In Spark applications, encountering challenges related to garbage collection (GC) is not uncommon and they can significantly impact performance and scalability. These issues include:</p><ul><li><strong>Long GC-Pauses</strong> resulting from traditional garbage collection algorithms (e.g. Concurrent Mark-Sweep (CMS)) which can introduce delays in application execution.</li><li><strong>Increased CPU Overhead</strong>: Garbage collection consumes significant computational resources and this results in the decrease of application throughput</li><li><strong>Inefficient Memory Usage</strong> due to suboptimal memory management and GC configurations and can result in inefficient memory usage.</li></ul><p>These issues highlight the importance of a deep understanding of GC behavior and optimization strategies to unlock the potential of Spark applications.</p><h4><strong>Garbage Collection Monitoring: Boosting Apache Spark performance</strong></h4><p>Apache Spark is designed to operate on large scale datasets across distributed clusters. So, monitoring Garbage Collection performance is essential for ensuring a better optimization of Apache Spark applications.</p><p>Several tools and methods for GC monitoring so that developers can provide insights into GC behavior. Here are some examples:</p><ul><li><strong>JVisualVM</strong>: A graphical user interface that allows developers to monitor JVM performance in real-time, including garbage collection activity, memory usage, and so on.</li><li><strong>GC Logs</strong>: provide detailed information about GC activity, such as pause times, heap utilization, and GC throughput. GC Logs are useful to conduct an in-depth analysis and identify performance bottlenecks.</li><li><strong>Spark Metrics</strong>: Spark built-in metrics that can be accessed through Spark UI or via Spark API for monitoring some aspects of Spark application performance, such as memory usage, task execution times, and GC activity.</li></ul><p>Using these tools and methods developers can have much information as possible to make decisions to optimize memory management and GC settings in order to improve Spark application performance and scalability.</p><p><strong>Fine-Tuning Garbage Collection for Apache Spark</strong></p><p>Within the distributed computing environment, where Spark applications it is important to fine tuning GC process large-scale datasets across clusters to minimize interruptions and maximize resource utilization.</p><p>One critical aspect is to fine-tuning the <strong>Java Virtual Machine (JVM) heap size</strong> to align with the memory requirements. of Spark applications. While a larger heap size can reduce the frequency of GC pauses, it may also increase overall memory overhead.</p><p>Selecting the appropriate <strong>GC algorithm</strong> is significative because the choice of GC algorithm can have a considerable impact on the overall performance and behavior of a Spark application. These options offer different trade-offs in terms of throughput, latency, and memory utilization.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*7EpYDptCXm6XR-GiUV7pgQ.png" /><figcaption>Types of GC algorithm</figcaption></figure><p>Here are some examples:</p><ul><li><strong>Concurrent Mark-Sweep (CMS)</strong>, in the first place minimize pause times to reduce application latency and this can be beneficial for interactive or real-time applications where responsiveness is fundamental.</li><li><strong>Garbage First (G1),</strong> aims to balance throughput and pause times. This is suitable for a wide spectrum of applications.</li><li><strong>Parallel GC</strong>, this algorithm maximize throughput using multiple threads to perform garbage collection concurrently. This behavior makes it useful for applications with high computational loads and parallel processing requirements.</li></ul><p>In more depth it is possible to configure <strong>JVM Flags</strong> in order to fine-tune GC. Some examples are the following:</p><pre>// specifying the maximum heap size<br>-Xmx<br><br>// controlling GC pause times<br>-XX:MaxGCPauseMillis<br><br>// exploring the Garbage First (G1) GC algorithm<br>// which aims to balance both throughput and pause times<br>-XX:+UseG1GC</pre><p>This ability to use flags gives the power to adjust GC settings to fit exactly what Spark applications need. It is possible to configure JVM Flags in the JVM configuration file or pass flags as arguments when start Spark application. Here is an example of JVM Flag when start Spark application:</p><pre>spark-submit --master &lt;master-url&gt; --executor-memory 2g --driver-memory 1g --conf spark.driver.extraJavaOptions=&quot;-Xmx8g -XX:MaxGCPauseMillis=400&quot; --conf spark.executor.extraJavaOptions=&quot;-Xmx8g -XX:MaxGCPauseMillis=400&quot; name-spark-application.jar</pre><pre>// option to set the maximum heap size to 8 gigabytes<br>-Xmx8g<br><br>// option to set the maximum GC pause time to 400 milliseconds<br>-XX:MaxGCPauseMillis=400</pre><h4><strong>Efficient memory management strategies for Apache Spark</strong></h4><p>To maximize performance in Spark application, strategies for optimize memory management is fundamental. <strong>Data serialization</strong> is one of the main memory management strategy that minimize memory overhead. This is possible using serialization formats such as Apache Parquet or Avro that also reduces data transfer and storage costs. Storing data outside the JVM heap by enabling <strong>off-heap</strong> memory allocation, allows to explore off-heap memory to reduce GC pressure and improve memory utilization.</p><p>An example of options for memory management strategies are the following:</p><pre>// setting to &#39;true&#39; allows Spark to use off-heap memory for some operations<br>spark.memory.offHeap.enabled<br><br>// sets the amount of memory to use for executor processes<br>spark.executor.memory<br><br>// sets the amount of memory to use for driver process<br>spark.driver.memory</pre><p>Spark property <strong>spark.memory.offHeap.enabled</strong> is using to enable off-heap memory. Based on demands of workloads requirements and the resources available within the cluster, it is necessary balance memory allocation by <strong>fine-tuning Spark memory</strong> options, such as <strong>spark.executor.memory</strong> and <strong>spark.driver.memory</strong>. Through these memory management strategies, it is possible to maximize the efficiency and scalability of Spark applications, ensuring continuous data processing and analysis across distributed environments.</p><h4><strong>Conclusions</strong></h4><p>In conclusion, Optimizing Java garbage collection is essential to achieving optimal performance in Apache Spark applications. Understanding GC behavior, Monitoring GC Performance monitoring performance of Spark application and Tuning GC for Spark is possible to maximize the efficiency and scalability of Spark applications across distributed clusters. Through monitoring and fine-tune GC, it is possible to ensure continuous data processing and analysis across distributed environments. Memory management strategies improve Spark application performance and lay the foundation for stability, efficiency and scalability of the Spark applications.</p><h4>References</h4><ul><li>Chambers B., Zaharia M.; Spark: The Definitive Guide; O’Reilly Media, Inc. (2018)</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f07d36ce8c1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-reply-it-datatech/optimizing-garbage-collection-in-apache-spark-3f07d36ce8c1">Optimizing Garbage Collection in Apache Spark</a> was originally published in <a href="https://medium.com/data-reply-it-datatech">Data Reply IT | DataTech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OCPM: An introduction to Object-Centric Process Mining]]></title>
            <link>https://medium.com/data-reply-it-datatech/ocpm-an-introduction-to-object-centric-process-mining-97d1930e798d?source=rss-eb148d051a43------2</link>
            <guid isPermaLink="false">https://medium.com/p/97d1930e798d</guid>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[process]]></category>
            <category><![CDATA[data-analytics]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[process-mining]]></category>
            <dc:creator><![CDATA[Gianpio Sozzo]]></dc:creator>
            <pubDate>Mon, 11 Dec 2023 09:18:11 GMT</pubDate>
            <atom:updated>2023-12-11T09:18:11.822Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*XwigECBhQ2V1oEChoKPkZA.png" /><figcaption>Photo by <a href="https://unsplash.com/@moritz_photography?utm_source=medium&amp;utm_medium=referral">Moritz Kindler</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Introduction</h3><p>Process Mining (PM) allows the analysis of business processes mainly focusing on process modeling based upon how its activities are related to each other. This can be useful to mine hidden knowledge (e.g. infrequent or outlier activities), define KPIs and improve processes. But within processes there are various objects that are related to events, interact with other objects and evolve over time. While traditional Process Mining techniques describe processes from an activities-perspective, Object-Centric Process Mining (OPCM) is able to capture and describe object-to-object (O2O) and event-to-object (E2O) interactions so that processes can be seen from any perspective. In this paper, the main Process Mining techniques will be briefly discussed to then pay specific focus on OCPM, how Object-Centric Event Data differs from traditional event log and the main Object-Centric Process Mining techniques focusing on the task of process discovering and conformance-checking.</p><h3>Process Mining Techniques</h3><p>As stated by <a href="https://www.gartner.com/en/information-technology/glossary/process-mining">Gartner</a> “<em>Process mining is a technique designed to discover, monitor and improve real processes (i.e., not assumed processes) by extracting readily available knowledge from the event logs of information systems</em>”.</p><p>First PM algorithms for workflow automation emerged at the end of the 1990-ties. Since then there have been many advances in the field of PM and the main techniques (e.g. process discovery, conformance checking) were consolidated. This allowed for further studies of more advanced and innovative techniques (e.g. Predictive and Streaming Process Mining, Action-Oriented Process Mining and Object-Centric Process Mining).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*y23Eqslk9DXoTeU5K1YfNw.png" /><figcaption>Process Mining techniques.</figcaption></figure><p>The main Process Mining techniques are the following:</p><ul><li><strong>Process Discovery</strong>: starting from an event log, process discovery algorithms automatically extract process models (e.g. in a Petri Net, BPMN notation) describing all behaviors observed in the underlying processes or just the dominant behaviors.</li><li><strong>Conformance Checking</strong>: event data are replayed on process models to allow an in-depth analysis regarding discrepancies or deviations between <em>To-Be</em> processes and <em>As-Is</em> process flows. Deviations may be related to undesired or unusual behaviors depending if the process model is normative or discovered and they are not limited to control flow but also to other perspective such as time, resources or data.</li><li><strong>Process Enhancement and Monitoring</strong>: a type of Process Mining to achieve a specific performance level and to fulfill requirements based on laws and regulations. These can be done through <em>process extension </em>and <em>process improvement</em> that allow to obtain process models with higher level of precision and without portion of models that do not meet specifications.</li></ul><h3>Object-Centric Process Mining</h3><p>The application of Process Mining adds value in many fields such as finance, logistics, production, energy, healthcare and so on. The assumption of the main PM techniques is that in the event log each event refers to one process instance so the discovered process models represent the lifecycle of a single object. But in reality, events could refer to various objects interacting with each other and evolve over time.</p><p>Object-Centric Process Mining (OCPM) goes beyond the limitations of traditional instance-centric Process Mining introducing the concepts of <strong>Objects</strong>, considered as the entities involved in events, and <strong>Object Types</strong>. It also integrates in the event log two type of relationships describing an <strong>Events-to-Object (E2O)</strong> and an <strong>Object-to-Object (O2O)</strong> interactions.</p><p>This forms the basis for the construction of a specific event log for OCPM, called <em>Object-Centric Event Log</em> <em>(OCEL)</em>.</p><h4>Object-Centric Event Log (OCEL)</h4><p>OCEL 1.0 standard was released in 2020 and since then the first Object-Centric process models was discovered using emerging OCPM techniques. In the 2023, OCEL 2.0 extends OCEL 1.0 providing a more expressive way to represent, store and exchange event log.</p><p>OCEL 2.0 offers three exchange formats: a relational database (SQLite), XML and JSON format.</p><p>The data structure in OCEL 2.0 gives the ability to access data in a simple way since each event type and each object type has its corresponding table. This brings several advantages including scalability and efficiency of storage and process analysis.</p><h4>Relational implementation of the standard</h4><p>In addition to the XML and JSON format of the OCEL 1.0, one of the key improvements of OCEL 2.0 is to include a relational implementation of the standard.</p><p>In the <a href="https://ocel-standard.org/specification/overview/">OCEL 2.0 specification</a> the following relational schema has been proposed:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/457/1*bcNsioOlYT86xd-uhCK4yA.png" /><figcaption>Relational schema of the relational implementation proposed in the <a href="https://ocel-standard.org/specification/overview/">OCEL 2.0 specification</a></figcaption></figure><p>The tables depicted in the relational schema are the following:</p><ul><li><strong><em>Event_map_type</em></strong> and <strong><em>Object_map_type</em></strong>, that distinct event types and object types.</li><li><strong><em>Event</em></strong> and <strong><em>Object</em></strong>, representing event type (evtype) and object type (objtype) for each event and for each object.</li><li>For every event type and for every object type there is a <em>table mapping the event types</em> (or the <em>object types</em>) to unique identifiers containing all the attributes associated with the given event type (or object type) as columns of the table. The object-type tables contain a history of the attributes along with the timestamp column so it is possible to reconstruct the value of an attribute at a specified point in time. The columns that are changed over time is highlighted in a specific column <em>ocel_changed_field.</em></li><li><strong><em>Event-object</em> </strong>and <strong><em>object-object</em></strong> tables contain E2O and O2O relationships, respectively, with a qualifier explaining the nature of the relationships.</li></ul><h4>OCPM Techniques</h4><p>Understanding and improving business processes is the main goals of standard Process Mining and Object-Centric Process Mining. Their differences lie in the way the underlying data are stored. Standard event logs assume that there is one case per event, whereas Object-Centric Event Logs assume that events could refer to various objects.</p><p>The main OCPM techniques are the following:</p><ul><li><strong>Object-Centric Process Discovery: </strong>from an Object-Centric Event Log it is possible to obtain multiple process models (e.g. Object-Centric Petri Nets with variable arcs as in the Colored-Petri Nets). Each process model refers to a single object type and need to be merged creating one Petri net in a way as to preserve their semantics.</li><li><strong>Object-Centric Conformance Checking: </strong>using traditional conformance checking techniques (e.g. token-based replay) from an Object-Centric process model it is possible to check constraint (e.g. E2O relationship and its cardinality) directly on the event log.</li></ul><h4>Using PM4PY for OCPM</h4><p><a href="https://pm4py.fit.fraunhofer.de/">pm4py</a> is an open-source Python library for the application of various Process Mining techniques. This library has been extended to also use OCPM.</p><p>The following code snippet use an <a href="https://ocel-standard.org/event-logs/simulations/order-management/">OCEL</a> in a JSON format describing the management of customer orders and the process of packing and shipping of these orders.</p><pre>import pm4py<br><br># Read the OCEL<br>ocel = pm4py.read.read_ocel2_json(&quot;order-management.json&quot;)<br><br># Get the list of object types in the OCEL<br>object_types = pm4py.ocel_get_object_types(ocel)<br>print(&quot;Object types: &quot;, object_types)<br><br># Return an OCEL with a subset of randomly chosen objects<br>sampled_ocel = pm4py.sample_ocel_objects(ocel, 50)<br><br># Get the list of object types in the sampled OCEL<br>object_types_sampled = pm4py.ocel_get_object_types(sampled_ocel)<br>print(&quot;Object types in the sampled OCEL: &quot;, object_types_sampled)<br><br># Get the set of activities for each object type<br>ot_activities_sampled = pm4py.ocel_object_type_activities(sampled_ocel)<br>print(&quot;Activities per object types in the sampled OCEL: &quot;, ot_activities_sampled)<br><br># Count for each event the number of objects per type<br>objects_ot_count_sampled = pm4py.ocel_objects_ot_count(sampled_ocel)<br>print(&quot;Number of related objects per type in the sampled OCEL: &quot;, objects_ot_count_sampled)</pre><p>This will print the following output:</p><pre>Object types: [&#39;orders&#39;, &#39;items&#39;, &#39;packages&#39;, &#39;customers&#39;, &#39;products&#39;, &#39;employees&#39;]<br>Object types in the sampled OCEL: [&#39;orders&#39;, &#39;items&#39;, &#39;packages&#39;]<br>Activities per object types in the sampled OCEL:<br>  {&#39;items&#39;: {&#39;place order&#39;, &#39;package delivered&#39;, &#39;confirm order&#39;, &#39;item out of stock&#39;,<br>              &#39;send package&#39;, &#39;reorder item&#39;, &#39;failed delivery&#39;, &#39;create package&#39;,<br>              &#39;pick item&#39;, &#39;pay order&#39;},<br>   &#39;packages&#39;: {&#39;send package&#39;, &#39;create package&#39;, &#39;package delivered&#39;}}<br>Number of related objects per type in the sampled OCEL:<br>  {&#39;confirm_o-990022&#39;: Counter({&#39;items&#39;: 1}),<br>    &#39;confirm_o-990068&#39;: Counter({&#39;orders&#39;}: 1}),<br>    &#39;deliver_p-660032&#39;: Counter({&#39;packages&#39;}: 1}),<br>    ...<br>  }</pre><p>pm4py library offers methods to Object-Centric process discovery such as the following to discover an Object-Centric Petri Net:</p><pre># Discover an Object-Centric Petri Net (OC-PN) from the sampled OCEL<br>ocpn = pm4py.discover_oc_petri_net(sampled_ocel)<br><br># Get a visualization of the OC-PN (Returns a Graphviz digraph)<br>gph = pm4py.visualization.ocel.ocpn.visualizer.apply(ocpn)<br><br># View the diagram using matplotlib<br>pm4py.visualization.ocel.ocpn.visualizer.matplotlib_view(gph)</pre><p>Based on the different sampled OCEL passed in the <em>discover_oc_petri_net</em><strong> </strong>method, several OC-PN can be visualized. The entire OCEL can lead to a <em>spaghetti-like process model</em> and for the sampled OCEL the resulting OC-PN appears to be more readable. This implies to consider methods to filtering or flattening OCEL in a such way that the discovered Object-Centric process models will have a better visualization and interpretation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cu87XW604EWaG-DIrbICSQ.png" /><figcaption>Object-Centric Petri Net discovered from the entire OCEL. This model appears to be spaghetti-like and therefore tends to be unreadable and difficult to interpret.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*EUGnUk5-ngBTuQ6gfnOt0Q.png" /><figcaption>Object-Centric Petri Net discovered from sampled OCEL. In this model there are two object types (items and package) and there are shared activities between them (create package, send package and package delivered).</figcaption></figure><h4>Conclusions</h4><p>Business processes can be analyzed to understand and improve them assuming that each event refers to one object. In most processes there are interactions between objects and these are not captured by the main Process Mining techniques. This paper firstly in short illustrated the main PM techniques and then described what is Object-Centric Process Mining (OCPM) and how it overcome standard PM challenges allowing also the analysis of Object-to-Object and Event-to-Object relationships. Object-Centric Event Log is also formalized and the main OCPM techniques are briefly discussed and an example of using PM4PY library for OCPM is illustrated. Moreover, using an OCEL with a well-defined semantics for object types and event types can be leverage for Generative AI to train Large Language Models (LLM) to generate new forms of Process Mining queries.</p><h4>References</h4><ul><li>Alessandro Berti et al., <em>OCEL (Object-Centric Event Log) 2.0 Specification</em>, 2023.</li><li>van der Aalst W.M.P., <em>Object-Centric Process Mining: Unraveling the Fabric of Real Processes</em>. Mathematics, 11(12):2691, 2023.</li><li>van der Aalst W.M.P., Berti A., <em>Discovering object-centric Petri nets</em>. Fundam. Informaticae 175(1–4), 1–40 (2020).</li><li>van der Aalst W.M.P. and Carmona J., <em>Process Mining Handbook.</em> volume 448 of Lecture Notes in Business Information Processing, Springer, 2022.</li><li><a href="https://pm4py.fit.fraunhofer.de/">https://pm4py.fit.fraunhofer.de/</a></li><li><a href="https://www.gartner.com/en/information-technology/glossary/process-mining">https://www.gartner.com/en/information-technology/glossary/process-mining</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=97d1930e798d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-reply-it-datatech/ocpm-an-introduction-to-object-centric-process-mining-97d1930e798d">OCPM: An introduction to Object-Centric Process Mining</a> was originally published in <a href="https://medium.com/data-reply-it-datatech">Data Reply IT | DataTech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The value of Process Mining]]></title>
            <link>https://medium.com/data-reply-it-datatech/the-value-of-process-mining-5ee7e91c44ee?source=rss-eb148d051a43------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ee7e91c44ee</guid>
            <category><![CDATA[business-process]]></category>
            <category><![CDATA[process-improvement]]></category>
            <category><![CDATA[process]]></category>
            <category><![CDATA[process-mining]]></category>
            <category><![CDATA[data-mining]]></category>
            <dc:creator><![CDATA[Gianpio Sozzo]]></dc:creator>
            <pubDate>Mon, 04 Sep 2023 13:18:25 GMT</pubDate>
            <atom:updated>2023-09-04T13:18:25.822Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/959/1*Eix64L3KiBXIO-NtwdSXlg.png" /></figure><p>Most real-life processes have not been optimized or are not even explicitly designed. In such situations, the application of Process Mining techniques can be used to discover and unveil hidden knowledge and to improve business processes. Process Mining (PM) is a discipline that can be seen as the intersection of Data Science and Process Science and it is useful to support process improvements, understanding process performances and support optimization activities. Process Mining extracts process models from the execution logs (also called <em>event logs</em>) coming from company’s databases, information systems or business management software such as Enterprise Resource Planning (ERP), Customer Relationship Management (CRM), Supply Chain Management (SCM), etc.</p><p>In this paper a brief introduction on Process Mining will be given, moving the focus on why it is important to introduce it in the digital transformation of organizations. The main concepts of the Process Mining and the PM techniques to extract value from business processes will also be illustrated. The potential benefits of Process Mining can be found in businesses of any size and in any industry for process analysis and optimization, conformance validation, detecting and diagnosing bottlenecks and deviations and for process automation support. Moreover, Process Mining can be used to create AI/ML problems to predict outcome or to trigger corrective actions.</p><p><strong>Introduction to Process Mining</strong></p><p>How much organizations know about their operational processes? Are they able to identify bottlenecks and deviations or to anticipate problems and trigger corrective actions? Is it possible to optimize actual processes and diagnose performance and compliance problems?</p><p>Process Mining can answer to these questions. But what is Process Mining? Process Mining is one of the most innovative and exciting technique supporting organizations to provide insights from their processes allowing to support decision-making. Process Mining can also be seen as the intersection between Data Science and Process Science as it embraces the main concepts from both fields to support Business Process Management with the consolidated and cutting-edge technologies.</p><p>When theoretical work on Process Mining starts at the end of the 1990-ties, the focus was on workflow automation. Advancements in the digital universe improved data gathering and analytics technologies make it possible to record and analyze events from any sources and in any businesses. This allowed to have event data readily available and to fine-tune PM techniques. With this constant technological evolution the principles of Process Mining can be applied not only in administrative or financial fields where the workflow management systems lie, but also in production, logistics, healthcare, government, and so on.</p><p>Although the first tool for Process Mining was created in the early 2000s, nowadays there are over 40 commercial PM tools. Process Mining is used by thousands of organizations and can be applied in any domain (finance and insurance, energy, logistics and transport, healthcare and so on).</p><p>At the beginning of 2023 Gartner published the first <a href="https://www.celonis.com/analyst-reports/gartner-magic-quadrant-2023/">Magic Quadrant for Process Mining</a>, demonstrating that companies tend to use Process Mining to analyze their processes.</p><p><strong>Why should processes be analyzed?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LjqdCOblElrTjLolOKmowQ.png" /></figure><p>If you could have a tool to view and understand any business processes in your company from single activity to an aggregated view, many insights can be extracted allowing you to enhance actual process, optimize workflow, automate repetitive activities and increase the efficiency of the process.</p><p>With increasing of data processing technologies, it is possibile to access to large amounts of event logs. Every single process activity can be analyzed providing a comprehensive overview of a process. Process Mining tools can visualize process models in a detailed view of a process as well as in an aggregate perspective. This provides to evaluate the actual process based on a different insight that can be extracted.</p><p>Once the Process Mining results are approved, most of the time of the top management is spent on discussing on <strong>why</strong> things are happening rather than <strong>what</strong> is happening. To understand processes and improve them it is important to firstly analyze the reasons for delays and loops. Based on the obtained insights, actions can be defined, deployed on the actual process and continuously monitored.</p><p>Below several examples of application domains in which Process Mining can be applied to face complexity, provide new insights and support digital transformation:</p><ul><li><em>CRM</em>: the main reason to apply Process Mining in this field is to process orders quickly and efficiently identifying delayed orders and reasons for <strong>delays</strong>.</li><li><em>Manufacturing</em>: <strong>bottlenecks</strong> can be identified in processes to optimize value stream and to reduce material waste, costs and unnecessary activities.</li><li><em>Finance and Accounting</em>: Process Mining can help to identify <strong>deviations</strong> between standard payment and confirmations.</li></ul><p><strong>How can Process Mining analyze and improve processes?</strong></p><p>Before starting any Process Mining project, it is necessary to consider three complementary essential factors:</p><ul><li><em>Purpose</em>: what is the Purpose for the usage of Process Mining?</li><li><em>People</em>: do the people involved have a mindset for change?</li><li><em>Process traces</em>: Are event logs available and reliable?</li></ul><p>Probably the biggest challenge for every Process Mining project is related to the <strong>data availability</strong>. Data is hidden in the source systems and usually stored in a distributed way. Furthermore, data can contain confidential information and it is important to make data anonymous and not ascribable to natural persons. Data must be complete with any information that can allow a 360-degree view of the business process and the process traces must be continuously available with minimum latency for analysis and for real-rime intervention on actual process.</p><p>Based on process traces stored in event logs, Process Mining allows to analyze business processes of any domains. An event log is a set of events each of which refers to a specific activity that took place in order to perform a business process and can be assigned to a unique case. An event log must have three mandatory attributes:</p><ul><li><em>Case ID</em>, a numeric identifier for a specific process instance</li><li><em>Activity</em>, that specifies which activity has taken place</li><li><em>Timestamp</em>, indicating the time when an activity has been taken</li></ul><p>Further attributes can be added to provide additional information about the activities such as resource, location, cost, etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DXfVlWUO5vPBsP0RxDejVw.png" /><figcaption>How does Process Mining work</figcaption></figure><p>Event data are assumed to be of a high-quality meaning that data have been extracted, selected, filtered and cleaned in a correct manner. <strong>Data extraction</strong> is an integral part of any Process Mining project, and probably may be time-consuming as data are stored over many database tables and they need to be converted into a specific format that can be used as input to apply PM techniques.</p><p>The main Process Mining techniques are the following:</p><ul><li><strong>Process Discovery</strong>: starting from an event log, process discovery techniques automatically extract <strong>process models</strong> describing all behavior observed or just the dominant behavior. Inspecting the discovered model, noteworthy insights can be mined.</li><li><strong>Conformance Checking</strong>: relates events in the event log to activities in the process model allowing an in-depth analysis regarding discrepancies or deviations between <em>To-Be processes</em> and <em>As-Is process</em> flows. Deviations may be related to undesired or unusual behavior depending if the process model in normative or discovered.</li><li><strong>Process Enhancement and monitoring</strong>: a type of Process Mining to achieve a specific performance level and to fulfill requirements based on laws and regulations. These can be done through <em>process extension</em> and <em>process improvement</em> that allow to obtain process models with higher level of precision and without portion of models that do not meet specifications.</li></ul><p>With advancements of technologies and with new demands in the use of Process Mining, other advanced PM techniques have emerged, such as the following:</p><ul><li><strong>Predictive Process Mining</strong>: a branch of Process Mining designed to predict future activities or the completion time of an ongoing process instance. Predictive PM allows organizations to prevent undesired outcomes, delays or the violation of a regulation before they occur.</li><li><strong>Streaming Process Mining</strong>: processing a stream of data aims to extract relevant insights about the ongoing processes. Streaming PM is useful in fields that require a <em>timely understanding</em> of the behavior and usage of a system rather than improving future process instances or inspecting past ones.</li><li><strong>Object-Centric Process Mining (OCPM)</strong>: this most recent development in the field of Process Mining allows to analyze the behavior of individual <strong>objects</strong> (such as customer or product) and interactions between them within the process. OCPM does not follow the case notation, the object-centric event data allow events to point to any number of objects rather than a single case.</li><li><strong>Action-Oriented Process Mining</strong>: it connects the knowledge extracted from event data to actions and it helps to respond when compliance problems or bottlenecks emerge and focusing on the improvement of the actions triggered by traditional Process Mining techniques.</li></ul><p><strong>Benefits of Process Mining</strong></p><p>Process Mining techniques can be <strong>backward-looking</strong> or <strong>forward-looking</strong> and aim respectively to find the root causes of a bottleneck in a process or to predict the remaining processing time or the remaining activities of a running process.</p><p>Process Mining provides noteworthy insights to organizations about their actual processes and allows them to diagnose problems and automatically trigger corrective actions. Process Mining can also reveal performance and compliance problems improving processes by reducing costs and removing delays.</p><p>The value of Process Mining has been documented in several use cases, some of which are the following:</p><ul><li><em>CRM</em>: analyzing event logs from orders up to payments it is possible to visualize each step of the process. Starting from these, considerable insights can be mined supporting the reduction of manual activities identifying potential automated activities or redundant activities. Thus, costs can be reduced and efficiency improved.</li><li><em>Manufacturing</em>: collecting and visualize process traces allows to perform a value stream analysis, including how and in what sequence activities are executed and how it takes to execute them. In this way bottlenecks can be found and process execution time can be improved. More information is present in the event logs and more optimizations can be conduct on the process such as reduction in stock or of wasted material.</li><li><em>Finance and Accounting</em>: the visualization of time sequence of each payment can identify deviations from standard payment terms or deviations between payment terms and confirmations. Moreover, predictions on upcoming or overdue payments can trigger actions proactively to alert from late or due payments.</li></ul><p>Using Process Mining value may be guaranteed in the form of visualization of the model learned from data, predictions, automated decisions or any type of data visualization and statistics.</p><p><strong>Conclusion</strong></p><p>Process Mining is capable of providing an overview of all events and processes in an organization. Extracting event logs, cleaning them and make them in the correct format is one of the most challenge in this field. The main Process Mining techniques can provide meaningful insights using event logs and even the model learned from data. Based on these insights, weak points can be identified and decisions taken in order to optimize actual process reducing costs and improving process effectiveness. Other advanced techniques can be applied on the event logs to perform Process Mining in a predictive or near real-time way or under perspectives other than workflows. Important values can be found in any domain of any business identifying bottlenecks and deviations, support compliance, diagnose performance and support the automation of repetitive activities.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ee7e91c44ee" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-reply-it-datatech/the-value-of-process-mining-5ee7e91c44ee">The value of Process Mining</a> was originally published in <a href="https://medium.com/data-reply-it-datatech">Data Reply IT | DataTech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>