Skip to main content

MLArena

Python Version PyPI Downloads License: MIT Tests Code style: black Imports: isort CI/CD

mlarena is an algorithm-agnostic machine learning toolkit for streamlined model training, diagnostics, and optimization. Implemented as a custom mlflow.pyfunc model, it ensures seamless integration with the MLflow ecosystem for robust experiment tracking, model versioning, and framework-agnostic deployment.

It blends smart automation that embeds ML best practices with comprehensive tools for expert-level customization and diagnostics. This unique combination fills the gap between manual ML development and fully automated AutoML platforms. Moreover, it comes with a suite of practical utilities for data analysis and visualizations - see our comparison with AutoML platforms to determine which approach best fits your needs.

Documentation

Read the MLArena documentation. Start with the Quickstart, read the user guide, or browse the API reference. For local previews and publishing updates, see Building and publishing documentation.

Publications

For a quick guide over the package

  • Build Algorithm-Agnostic ML Pipelines in a Breeze - Published in Towards Data Science

    This article discussed some key challenges in algorithm-agnostic ML Pipeline building and demonstractes how MLarena can help to address them. Although more functionalities have been added after the publication of the article on 7 July 2025, it is nonetheless a good overview of MLarena's core functionalies and a good quick guide for starting with the package.

On specific functionalities

  • Help Your Model Learn the True Signal - Published in Towards Data Science

    This article explores the challenges of investigating data points that disproportionately disrupt a model's ability to learn the dominant signal. By leveraging an algorithm-agnostic approach inspired by Cook's Distance, it provides a method to effectively identify and diagnose these disruptive data points, ensuring that models capture stable, generalizable patterns. This technique is implemented as a helper function calculate_cooks_d_like_influence in the MLarena package, and is compatiable with any sklearn style ML algorithms.

  • When a Difference Actually Makes a Difference - Published in Towards Data Science

    This article offers actional steps for business decision makers to analyze group differences and avoid costly data misinterpretations. It demonstrates how three distinct business realities can hide behind a single bar chart, and offers a method to reveal the full story for more informed decision-making. This technique, including the visualization and statistical testing, is implemented as a helper function plot_box_scatter in the MLarena package.

The concepts and methodologies behind MLArena:

  • Algorithm-Agnostic Model Building with MLflow - Published in Towards Data Science

    A foundational guide demonstrating how to build algorithm-agnostic ML pipelines using mlflow.pyfunc. The article explores creating generic model wrappers, encapsulating preprocessing logic, and leveraging MLflow's unified model representation for seamless algorithm transitions.

  • Explainable Generic ML Pipeline with MLflow - Published in Towards Data Science

    An advanced implementation guide that extends the generic ML pipeline with more sophisticated preprocessing and SHAP-based model explanations. The article demonstrates how to build a production-ready pipeline that supports both classification and regression tasks, handles feature preprocessing, and provides interpretable model insights while maintaining algorithm agnosticism.

Installation

MLArena 0.6.0 requires Python 3.10–3.13 and MLflow >=3.0.1,<4.

Install in a compatible python environment, including Databricks serverless:

%pip install mlarena==0.6.0

On Databricks ML Runtime >=17.3, you can install MLArena using the bundled dependencies,provided they meet its version requirements.

%pip install mlarena==0.6.0 --no-deps

For MLflow 2.x, install MLArena 0.5.2 or earlier and retain your existing dependency pins.

Usage Example

Visual Examples:

Quick Start

Train and evaluate models quickly with mlarena's default preprocessing pipeline, comprehensive reporting, and model explainability. The framework handles the complexities behind the scenes, allowing you to focus on insights rather than boilerplate code. See 1.basic_usage.ipynb for complete examples.

Category Classification Metrics & Plots Regression Metrics & Plots
Metrics Evaluation Parameters
• Threshold (classification cutoff)
• Beta (F-beta weight parameter)

Core Performance Metrics
• Accuracy (overall correct predictions)
• Precision (true positives / predicted positives)
• Recall (true positives / actual positives)
• F1 Score (harmonic mean of Precision & Recall)
• Fβ Score (weighted harmonic mean, if β ≠ 1)
• AUC (ranking quality)
• MCC (Matthews Correlation Coefficient)
• Log Loss (confidence-weighted error)
• Brier Score (probability calibration quality)

Prediction Distribution
• Positive Rate (fraction of positive predictions)
• Base Rate (actual positive class rate)
Error Metrics
• RMSE (Root Mean Squared Error)
• MAE (Mean Absolute Error)
• Median Absolute Error
• NRMSE (Normalized RMSE as % of)
  • mean
  • std
  • IQR
• MAPE (Mean Absolute Percentage Error, excl. zeros)
• SMAPE (Symmetric Mean Absolute Percentage Error)

Goodness of Fit
• R² (Coefficient of Determination)
• Adjusted R²

Improvement over Baseline
• RMSE Improvement over Mean Baseline (%)
• RMSE Improvement over Median Baseline (%)
Plots • Metrics vs Threshold (Precision, Recall, Fβ, with vertical threshold line)
• ROC Curve
• Confusion Matrix (with colored overlays)
• Residual analysis (residuals vs predicted, with 95% prediction interval)
• Prediction error plot (actual vs predicted, with perfect prediction line and error bands)

Classification Models

Classification Model Performance

Regression Models

Regression Model Performance

Explainable ML

One liner to create global and local explanation based on SHAP that will work across various classification and regression algorithms.

Global Explanation

Local Explanation

Dependence Plot

Hyperparameter Optimization

mlarena offers iterative hyperparameter tuning with cross-validation for robust results and parallel coordinates visualization for search space diagnostics. See 2.advanced_usage.ipynb for more.

Hyperparameter Search Space

Plotting Utility Functions

mlarena offers handy utility visualizations for data exploration. Pls see 3.utils_plot.ipynb for more.

plot_box_scatter for comparing numerical distributions across categories with optional statistical testing

plot_box_scatter

plot_distribution_over_time for comparing numerical distributions over time

plot_distribution_over_time

plot_distribution_over_time color points using point_hue

plot_distribution_over_time_point_hue

plot_stacked_bar_over_time for comparing categorical distributions over time

plot_stacked_bar_over_time

plot_metric_event_over_time

Data Utilities

Some handy utilities for data validation, cleaning and manipulations. Pls see 3.utils_data.ipynb for more.

is_primary_key

is_primary_key

Features

Algorithm Agnostic ML Pipeline

  • Unified interface for any scikit-learn compatible model
  • Consistent workflow across classification and regression tasks
  • Automated report generation with comprehensive metrics and visuals
  • Built on mlflow.pyfunc for seamless MLOps integration
  • Automated experiment tracking of parameters, metrics, and models
  • Simplified handoff from experimentation to production via the MLflow framework

Intelligent Preprocessing

  • Streamlined feature preprocessing with smart defaults and minimal code
  • Automatic feature analysis with data-driven encoding recommendations
  • Integrated target encoding with visualization for optimal smoothing selection
  • Feature filtering based on information theory metrics (mutual information)
  • Intelligent feature name sanitization to prevent pipeline failure
  • Handles the full preprocessing pipeline from missing values to feature encoding
  • Seamless integration with scikit-learn and MLflow for production deployment

Model Optimization

  • Efficient hyperparameter tuning with Optuna's TPE sampler
  • Smart early stopping with patient pruning to save computation resources
    • Configurable early stopping parameter
    • Startup trials before pruning begins
    • Warmup steps per trial
  • Cross-validation with variance penalty to prevent overfitting
  • Parallel coordinates visualization for search history tracking and parameter space diagnostics
  • Automated threshold optimization with business-focused F-beta scoring
    • Cross-validation or bootstrap methods
    • Configurable beta parameter for precision/recall trade-off
    • Confidence intervals for bootstrap method
  • Flexible metric selection for optimization
    • Classification: AUC (default), F1, accuracy, log_loss, MCC
    • Regression: RMSE (default), MAE, median_ae, SMAPE, NRMSE (mean/std/IQR)

Performance Analysis

  • Comprehensive metric tracking
    • Classification: AUC, F1, Fbeta, precision, recall, accuracy, log_loss, MCC, positive_rate, base_rate
    • Regression: RMSE, MAE, median_ae, R2, adjusted R2, MAPE, SMAPE, NRMSE (mean/std/IQR), improvement over mean/median baselines
  • Performance visualization
    • Classification:
      • Metrics vs Threshold plot (precision, recall, F-beta)
      • ROC curve with AUC score
      • Confusion matrix with color-coded cells
    • Regression:
      • Residual analysis with 95% prediction intervals
      • Prediction error plot with perfect prediction line and error bands
  • Model interpretability
    • Global feature importance
    • Local prediction explanations

Utils

  • Advanced plotting utilities
    • Distribution analysis
      • plot_box_scatter: Box plots with scatter overlay and statistical testing
        • Optional point coloring by category
        • Built-in statistical tests (ANOVA, Welch, Kruskal)
        • Customizable point jittering and transparency
    • Time series visualization
      • plot_metric_event_over_time: Track metrics with event annotations
        • Support for dual y-axes
        • Automatic date formatting based on time range
        • Customizable event markers and labels
        • Min/max value annotations
      • plot_distribution_over_time: Track distributions over time
        • Box plots with scatter overlay for each time period
        • Optional point coloring by category
        • Flexible time aggregation (hourly/daily/monthly/yearly)
        • Summary statistics for each period
      • plot_stacked_bar_over_time: Track categorical distributions
        • Percentage or count-based stacking
        • Flexible time aggregation
        • Custom category labeling
        • Automatic legend and color management
    • Categorical analysis
      • plot_stacked_bar: Stacked bar charts with statistical testing
        • Built-in chi-square and G-tests
        • Percentage or count-based visualization
        • Custom category labeling
  • Statistical analysis utilities
    • Group comparison tools
      • compare_groups: Statistical testing across groups with visualization
      • add_stratified_groups: Create balanced groups with stratification
      • optimize_stratification_strategy: Find optimal stratification columns
    • Power analysis and sample size calculation
      • power_analysis_numeric: Power calculation for t-tests
      • power_analysis_proportion: Power calculation for proportion tests
      • sample_size_numeric: Required sample size for numeric outcomes
      • sample_size_proportion: Required sample size for proportion tests
      • numeric_effectsize: Cohen's d effect size calculation
  • Data manipulation tools
    • Standardized dollar amount cleaning for financial analysis
    • Value counts with percentage calculation for categorical analysis
    • Smart date column transformation with flexible format handling
    • Schema and data quality utilities
      • Primary key validation with detailed diagnostics
      • Alphabetically sorted schema display
      • Safe column selection with case sensitivity options
      • Automatic removal of fully null columns
    • Complete Duplicate Management Workflow: "Discover → Investigate → Resolve":
      • Use is_primary_key to discover the existance of duplication issues
      • Use find_duplicates to analyze duplicate patterns
      • Use deduplicate_by_rank to intelligently resolve duplicates with business logic
  • I/O utilities
    • save_object: Store Python objects to disk with customizable options
      • Support for pickle and joblib backends
      • Optional date stamping in filenames
      • Compression support for joblib backend
    • load_object: Retrieve Python objects with automatic backend detection
      • Seamless loading regardless of storage format
      • Direct compatibility with paths returned by save_object

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for mlarena 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mlarena 0.6.0
File Size Uploaded Provenance Actions
mlarena-0.6.0.tar.gz 79.7 kB Without provenance Details for mlarena-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mlarena 0.6.0
File Interpreter ABI Platform Actions
mlarena-0.6.0-py3-none-any.whl Python 3 none any Details for mlarena-0.6.0-py3-none-any.whl

Total release size: 158.6 kB

Release files / mlarena-0.6.0.tar.gz

Download URL mlarena-0.6.0.tar.gz
Size 79.7 kB
Tags Source
SHA-256 checksum
How to use checksums
77d2cbe0bc7055f1977e474ef7c9293908bb8c5b460f031d5c746dda29ad3da5
BLAKE2b-256 checksum
How to use checksums
4874ab56d46431212e7b1bc8eea98664897a7c3546e3bb239732bc24ed8327fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.11.16 Linux/6.17.0-1022-azure

Release files / mlarena-0.6.0-py3-none-any.whl

Download URL mlarena-0.6.0-py3-none-any.whl
Size 78.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
630e28df277f12d976c2a9760d514422f1bed1bc8b7544c038e9bbce4b4a10a1
BLAKE2b-256 checksum
How to use checksums
cfc1ac684eca82ab7a3db35c09570857dc1d24aa3ac69d1bd890e33498f2721f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.11.16 Linux/6.17.0-1022-azure

Security for mlarena 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page