Skip to content

API Reference

open_mlpipe

open_mlpipe.run

run(data: str, target: str | None = None, project: str = 'open-mlpipe')

Run the full ML pipeline on a dataset.

PARAMETER DESCRIPTION
data

Path to CSV/Parquet/Excel file

TYPE: str

target

Target column name (auto-detected if None)

TYPE: str | None DEFAULT: None

project

Project name for tracking

TYPE: str DEFAULT: 'open-mlpipe'

RETURNS DESCRIPTION

PipelineContext with all results, metrics, and the trained model

Source code in src\open_mlpipe\__init__.py
def run(data: str, target: str | None = None, project: str = "open-mlpipe"):
    """Run the full ML pipeline on a dataset.

    Args:
        data: Path to CSV/Parquet/Excel file
        target: Target column name (auto-detected if None)
        project: Project name for tracking

    Returns:
        PipelineContext with all results, metrics, and the trained model
    """
    from open_mlpipe.config.resolver import build_level1_config
    config = build_level1_config(data, target)
    config.project = project
    runner = PipelineRunner(config)
    return runner.run()

open_mlpipe.run_config

run_config(config_path: str, project: str | None = None)

Run the full ML pipeline from a YAML config file.

PARAMETER DESCRIPTION
config_path

Path to YAML config file

TYPE: str

project

Override project name (optional)

TYPE: str | None DEFAULT: None

RETURNS DESCRIPTION

PipelineContext with all results, metrics, and the trained model

Source code in src\open_mlpipe\__init__.py
def run_config(config_path: str, project: str | None = None):
    """Run the full ML pipeline from a YAML config file.

    Args:
        config_path: Path to YAML config file
        project: Override project name (optional)

    Returns:
        PipelineContext with all results, metrics, and the trained model
    """
    from open_mlpipe.config.resolver import load_config, resolve_config
    from open_mlpipe.utils.io import load_data
    config = load_config(config_path)
    if project:
        config.project = project
    df = load_data(config.data.path)
    config = resolve_config(config, df)
    runner = PipelineRunner(config)
    return runner.run()

open_mlpipe.PipelineConfig

Bases: BaseModel

Full pipeline configuration.

open_mlpipe.PipelineRunner

PipelineRunner(config: PipelineConfig, registry: StageRegistry | None = None)

Executes a pipeline from config through all stages.

Source code in src\open_mlpipe\core\pipeline.py
def __init__(self, config: PipelineConfig, registry: StageRegistry | None = None) -> None:
    self.config = config
    self.registry = registry or StageRegistry()
    self.ctx = PipelineContext(config=config)

Methods:

run

run() -> PipelineContext

Execute the full pipeline.

Source code in src\open_mlpipe\core\pipeline.py
def run(self) -> PipelineContext:
    """Execute the full pipeline."""
    from open_mlpipe.stages import (
        CleanStage,
        CompareStage,
        DataLoaderStage,
        DeployStage,
        EDALoaderStage,
        EvaluateStage,
        ExplainStage,
        FeatureEngStage,
        PreprocessStage,
        SaveStage,
        SelectStage,
        SplitStage,
        TuneStage,
    )

    # Register all stages
    stages: list[Stage] = [
        DataLoaderStage(),
        EDALoaderStage(),
        CleanStage(),
        FeatureEngStage(),
        SplitStage(),
        PreprocessStage(),
        CompareStage(),
        TuneStage(),
        SelectStage(),
        EvaluateStage(),
        ExplainStage(),
        SaveStage(),
    ]

    if self.config.deployment.enabled:
        stages.append(DeployStage())

    for s in stages:
        self.registry.register(s)

    # Print header
    self._print_header()

    # Execute stages
    for stage in self.registry.default_order():
        if not self.registry.has(stage):
            continue
        s = self.registry.get(stage)
        if s.should_skip(self.ctx):
            console.print(f"  [dim]skip {stage}[/dim]")
            continue

        self._run_stage(s)

        # Resolve config after data is loaded (need raw_data for auto-detection)
        if stage == "load" and self.ctx.raw_data is not None:
            self.config = resolve_config(self.config, self.ctx.raw_data)
            self.ctx.config = self.config

    # Print summary
    self._print_summary()

    return self.ctx