# automl/auto-sklearn architecture

> Architecture diagram of the GitHub repository automl/auto-sklearn, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/automl/auto-sklearn
- Repository: https://github.com/automl/auto-sklearn

## Overview

##### Main Components

a. Core AutoML Engine
- AutoSklearnClassifier/AutoSklearnRegressor (Entry points)
- SMBO (Sequential Model-Based Optimization)
- Meta-learning System
- Ensemble Builder

b. Pipeline Components
- Data Preprocessing
- Feature Preprocessing
- Model Training/Evaluation
- Ensemble Selection

##### Component Relationships

**Input Data → Data Validation → Meta-learning → SMBO Optimization → Ensemble Building → Final Model**

##### Detailed Component Breakdown

a. Data Processing Layer:
- Feature Validation
- Target Validation
- Data Type Handling (Numerical/Categorical/Text)
- Imputation
- Encoding
- Scaling

b. Meta-learning Layer:
- Meta-feature Extraction
- Dataset Matching
- Configuration Suggestion

c. Optimization Layer:
- SMBO Controller
- Hyperparameter Optimization
- Model Selection
- Cross-validation

d. Ensemble Layer:
- Model Storage
- Ensemble Selection
- Prediction Aggregation

##### Key Interactions to Highlight

a. External Interfaces:
- scikit-learn compatibility layer
- Data input/output
- Model persistence

b. Internal Workflows:
- Meta-learning feedback loop
- Optimization cycle
- Ensemble building process

##### Technical Details

- Parallel execution support
- Dask integration
- Persistent storage handling
- Memory management
- Cross-validation splits

##### Implementation Notes

- The modular pipeline architecture
- The extensible component system
- The meta-learning optimization approach
- The ensemble selection strategy

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Legend
        L1[Core Components]:::core
        L2[Data Processing]:::data
        L3[Meta-learning]:::meta
        L4[Optimization]:::opt
        L5[Ensemble]:::ensemble
        L6["--> Data Flow"]
        L7["..> Control Flow"]
    end

    subgraph "Entry Points"
        AC["AutoSklearnClassifier"]:::core
        AR["AutoSklearnRegressor"]:::core
    end
    click AC "https://github.com/automl/auto-sklearn/blob/development/autosklearn/classification.py"
    click AR "https://github.com/automl/auto-sklearn/blob/development/autosklearn/regression.py"

    subgraph "Data Processing Layer"
        FV["Feature Validator"]:::data
        TV["Target Validator"]:::data
        DT["Data Type Handler"]:::data
        PP["Pipeline Preprocessing"]:::data
    end
    click FV "https://github.com/automl/auto-sklearn/blob/development/autosklearn/data/feature_validator.py"
    click TV "https://github.com/automl/auto-sklearn/blob/development/autosklearn/data/target_validator.py"
    click PP "https://github.com/automl/auto-sklearn/tree/development/autosklearn/pipeline/components/data_preprocessing/"

    subgraph "Meta-learning Layer"
        MF["Meta-feature Extraction"]:::meta
        DM["Dataset Matching"]:::meta
        CS["Configuration Suggestion"]:::meta
    end
    click MF "https://github.com/automl/auto-sklearn/tree/development/autosklearn/metalearning/metafeatures/"
    click DM "https://github.com/automl/auto-sklearn/tree/development/autosklearn/metalearning/"
    click CS "https://github.com/automl/auto-sklearn/tree/development/autosklearn/metalearning/metalearning/"

    subgraph "Optimization Layer"
        SMBO["SMBO Controller"]:::opt
        HPO["Hyperparameter Optimization"]:::opt
        MS["Model Selection"]:::opt
        CV["Cross-validation"]:::opt
    end
    click SMBO "https://github.com/automl/auto-sklearn/blob/development/autosklearn/smbo.py"
    click CV "https://github.com/automl/auto-sklearn/tree/development/autosklearn/evaluation/"

    subgraph "Ensemble Layer"
        EB["Ensemble Builder"]:::ensemble
        ES["Ensemble Selection"]:::ensemble
        PA["Prediction Aggregation"]:::ensemble
    end
    click EB "https://github.com/automl/auto-sklearn/tree/development/autosklearn/ensemble_building/"
    click ES "https://github.com/automl/auto-sklearn/tree/development/autosklearn/ensembles/"

    subgraph "Pipeline Architecture"
        PB["Pipeline Base"]:::core
        PC["Pipeline Classification"]:::core
        PR["Pipeline Regression"]:::core
    end
    click PB "https://github.com/automl/auto-sklearn/blob/development/autosklearn/pipeline/base.py"
    click PC "https://github.com/automl/auto-sklearn/blob/development/autosklearn/pipeline/classification.py"
    click PR "https://github.com/automl/auto-sklearn/blob/development/autosklearn/pipeline/regression.py"

    Input[("Input Data")]
    Output[("Final Model")]

    Input --> FV
    FV --> TV
    TV --> DT
    DT --> PP

    PP --> MF
    MF --> DM
    DM --> CS

    CS --> SMBO
    SMBO --> HPO
    HPO --> MS
    MS --> CV
    CV -.-> SMBO

    CV --> EB
    EB --> ES
    ES --> PA
    PA --> Output

    AC --> PB
    AR --> PB
    PB --> PP

    classDef core fill:#a4c2f4
    classDef data fill:#b7e1cd
    classDef meta fill:#ffd666
    classDef opt fill:#d5a6bd
    classDef ensemble fill:#ffe599
    classDef default fill:#ffffff
```
