Skip to main content

Process Mining library aimed at making PM accessible to new users

Project description

Heraclitus

Heraclitus Logo

PyPI Version Python Versions License Stars

A Python library aimed at making Process Mining accessible to new users. Works well with PM4PY but adds additional features for analysis and visualization.

Features

  • EventLog Management: Easy to use interface for loading, filtering, and manipulating process event data
  • Process Visualization:
    • Static process maps and activity frequency charts
    • Interactive visualizations with Plotly
    • Timeline visualizations and bottleneck dashboards
  • Time Metrics: Calculate cycle times, waiting times, and processing times
  • Statistical Analysis:
    • Compare process variants and identify bottlenecks
    • Distribution fitting and hypothesis testing
  • Large Dataset Support:
    • DuckDB integration for handling datasets larger than memory
    • Efficient querying and filtering of large process logs
  • Machine Learning:
    • Predictive models for process outcomes
    • Duration prediction with regression and classification
    • Feature engineering tools for process data
  • Anomaly Detection:
    • Identify unusual process behaviors
    • Detect outlier cases and process variants
    • Visualize anomalies for investigation
  • Process Discovery (NEW in v0.2.0):
    • Custom process discovery algorithms
    • Conformance checking capabilities
    • BPMN export functionality
  • PM4PY Integration (NEW in v0.2.0):
    • Seamless conversion between Heraclitus and PM4PY formats
    • Use PM4PY algorithms with Heraclitus EventLogs
    • Enhanced visualizations for process models
  • Performance Optimization (NEW in v0.2.0):
    • Vectorized operations for metrics
    • Caching for repeated calculations

Installation

# Install from PyPI
pip install heraclitus

# Install with PM4PY integration
pip install heraclitus[pm4py]

# Install with machine learning features
pip install heraclitus[ml]

# Install with all optional dependencies
pip install heraclitus[pm4py,ml,dev]

Or install from source:

git clone https://github.com/yourusername/heraclitus.git
cd heraclitus
pip install -e .

Quick Start

import pandas as pd
from heraclitus.data import EventLog
from heraclitus.visualization import create_interactive_process_map
from heraclitus.metrics import calculate_cycle_time

# Create an event log from a DataFrame
df = pd.read_csv("your_data.csv")
event_log = EventLog(df)

# Analyze cycle time
avg_time = calculate_cycle_time(event_log, unit="hours")
print(f"Average cycle time: {avg_time:.2f} hours")

# Create an interactive visualization
fig = create_interactive_process_map(event_log)
fig.write_html("process_map.html")  # Interactive HTML file

Working with Large Datasets

from heraclitus.data import DuckDBConnector

# Initialize DuckDB connector
db = DuckDBConnector("process_data.duckdb")

# Load large CSV file
db.load_csv("large_event_log.csv", table_name="events")

# Query and convert to EventLog
filtered_log = db.query_to_eventlog("""
    SELECT * FROM events 
    WHERE timestamp >= '2023-01-01' 
    AND activity = 'Process Application'
""")

# Analyze the filtered log
print(f"Filtered log contains {filtered_log.case_count()} cases")

Machine Learning and Anomaly Detection

from heraclitus.ml import OutcomePredictor, ProcessAnomalyDetector, FeatureExtractor

# Extract features from event log
feature_extractor = FeatureExtractor(event_log)
features_df = feature_extractor.extract_case_features()

# Train a prediction model
predictor = OutcomePredictor()
model_info = predictor.train(event_log, model_type="random_forest")
predictions = predictor.predict(features_df)

# Detect process anomalies
anomaly_detector = ProcessAnomalyDetector()
anomaly_detector.train(event_log, method="isolation_forest")
anomalies = anomaly_detector.detect_anomalies(features_df)

Requirements

  • Python 3.10-3.12
  • pandas
  • matplotlib
  • numpy
  • scipy
  • plotly
  • duckdb
  • scikit-learn (for ML features)

Examples

Check out the examples directory for detailed usage examples:

  • basic_usage.py: Simple EventLog operations
  • statistical_analysis.py: Statistical comparisons and bottleneck analysis
  • interactive_visualization.py: Interactive Plotly visualizations
  • duckdb_large_datasets.py: Working with large datasets
  • machine_learning.py: Predictive modeling and anomaly detection
  • process_discovery.py: Process discovery and conformance checking (NEW)

Documentation

See the Documentation for comprehensive guides and tutorials.

Development

See the Developer Guide for detailed information on the architecture and design principles.

Run tests:

pytest tests/

Roadmap

See ROADMAP.md for planned features and improvements.

Contributing

Contributions are welcome! See CONTRIBUTING.md for guidelines.

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

heraclitus-0.2.0.tar.gz (47.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

heraclitus-0.2.0-py3-none-any.whl (48.8 kB view details)

Uploaded Python 3

File details

Details for the file heraclitus-0.2.0.tar.gz.

File metadata

  • Download URL: heraclitus-0.2.0.tar.gz
  • Upload date:
  • Size: 47.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for heraclitus-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3784c96e3625692ba4088abd81d45e33362d17181d030f33af999faca4062df6
MD5 f4bfd542a79b113e5c8ec7addd046cc1
BLAKE2b-256 5fb52855d3f552a7ccaa4dd751106990046a9e4b64d6adb50f2d4e96133ab74a

See more details on using hashes here.

File details

Details for the file heraclitus-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: heraclitus-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 48.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for heraclitus-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 112d8533a110a3a684ee8a2827ceb75b56885d71b404b5ce6f7c692f1cb73593
MD5 e637b6c3da87215f330ca78a82a9dead
BLAKE2b-256 289efd508812f1b7de824ac02b59e0595c6f3492506c60b68e6cc221c19dfbb3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page