> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fiddler.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Baseline

> Baseline for drift detection and model performance monitoring.

Baseline for drift detection and model performance monitoring.

A Baseline defines a reference point for comparing production data against expected
patterns. It serves as the foundation for detecting data drift, model performance
degradation, and distributional changes in ML systems.

## Example

```python theme={null}
# Create a static baseline from training data
baseline = Baseline(
    name="production_baseline_v1",
    model_id=model.id,
    environment=EnvType.PRE_PRODUCTION,
    dataset_id=training_dataset.id,
    type_="STATIC"
).create()

# Create a rolling 30-day baseline
rolling_baseline = Baseline(
    name="rolling_30day",
    model_id=model.id,
    environment=EnvType.PRODUCTION,
    type_="ROLLING_WINDOW",
    window_bin_size=WindowBinSize.DAY,
    offset_delta=30
).create()

# Monitor drift detection
print(f"Baseline '{baseline.name}' has {baseline.row_count} records")
print(f"Created: {baseline.created_at}")
```

<Info>
  Baselines are immutable once created. To modify baseline parameters,
  create a new baseline and update your monitoring configurations.
</Info>

Initialize a Baseline instance.

Creates a baseline configuration for drift detection and monitoring. The baseline
serves as a reference point for comparing production data against expected patterns.

## Parameters

<ParamField path="name" type="str" required={true}>
  Human-readable name for the baseline. Should be descriptive
  and unique within the model context.
</ParamField>

<ParamField path="model_id" type="UUID | str" required={true}>
  UUID of the model this baseline belongs to. Must be a valid
  model that exists in the Fiddler platform.
</ParamField>

<ParamField path="environment" type="EnvType" required={true}>
  Environment type (PRE\_PRODUCTION or PRODUCTION).
  Determines the data environment this baseline monitors.
</ParamField>

<ParamField path="type_" type="str" required={true}>
  Baseline type. Supported values:

  * "STATIC": Fixed dataset reference (requires dataset\_id)
  * "ROLLING\_WINDOW": Sliding time window (requires offset\_delta)
  * "PREVIOUS\_PERIOD": Previous time period comparison
</ParamField>

<ParamField path="dataset_id" type="UUID | str | None" required={false} default="None">
  UUID of the reference dataset. Required for STATIC baselines,
  optional for time-based baselines.
</ParamField>

<ParamField path="start_time" type="int | None" required={false} default="None">
  Start timestamp for time-based baselines (Unix timestamp).
  Defines the beginning of the reference period.
</ParamField>

<ParamField path="offset_delta" type="int | None" required={false} default="None">
  Time offset in days for rolling/previous period baselines.
  For ROLLING\_WINDOW: size of the sliding window.
  For PREVIOUS\_PERIOD: how far back to compare.
</ParamField>

<ParamField path="window_bin_size" type="WindowBinSize | str | None" required={false} default="None">
  Aggregation window for time-series analysis.
  Controls how data is grouped for comparison.
</ParamField>

## Example

```python theme={null}
# Static baseline from training data
baseline = Baseline(
    name="training_baseline_v2",
    model_id=model.id,
    environment=EnvType.PRE_PRODUCTION,
    dataset_id=training_dataset.id,
    type_="STATIC"
)

# Rolling 7-day window baseline
rolling_baseline = Baseline(
    name="weekly_rolling",
    model_id=model.id,
    environment=EnvType.PRODUCTION,
    type_="ROLLING_WINDOW",
    offset_delta=7,
    window_bin_size=WindowBinSize.DAY
)

# Previous month comparison baseline
monthly_baseline = Baseline(
    name="month_over_month",
    model_id=model.id,
    environment=EnvType.PRODUCTION,
    type_="PREVIOUS_PERIOD",
    offset_delta=30,
    window_bin_size=WindowBinSize.DAY
)
```

<Info>
  After initialization, call create() to persist the baseline to the
  Fiddler platform. The baseline configuration cannot be modified
  after creation.
</Info>

## *classmethod* get()

Retrieve a baseline by its unique identifier.

Fetches a baseline from the Fiddler platform using its UUID. This method
returns the complete baseline configuration including metadata and statistics.

### Parameters

<ParamField path="id_" type="UUID | str" required={true}>
  The unique identifier (UUID) of the baseline to retrieve.
  Can be provided as a UUID object or string representation.
</ParamField>

### Returns

<ResponseField type="Baseline">
  The baseline instance with all configuration
  and metadata populated from the server.
</ResponseField>

### Raises

* **NotFound** – If no baseline exists with the specified ID.
* **ApiError** – If there's an error communicating with the Fiddler API.

### Example

```python theme={null}
# Retrieve baseline by ID
baseline = Baseline.get(id_="550e8400-e29b-41d4-a716-446655440000")
print(f"Baseline: {baseline.name}")
print(f"Type: {baseline.type}")
print(f"Environment: {baseline.environment}")
print(f"Records: {baseline.row_count}")

# Check baseline configuration
if baseline.type == "STATIC":

    print(f"Reference dataset: {baseline.dataset_id}")

elif baseline.type == "ROLLING_WINDOW":
    print(f"Window size: {baseline.offset_delta} days")
    print(f"Bin size: {baseline.window_bin_size}")
```

<Info>
  This method makes an API call to fetch the latest baseline information
  from the server, including any updated statistics or metadata.
</Info>

## *classmethod* from\_name()

Get the baseline instance of a model from baseline name

### Parameters

<ParamField path="name" type="str" required={true}>
  Baseline name
</ParamField>

<ParamField path="model_id" type="UUID | str" required={true}>
  Model identifier
</ParamField>

### Returns

<ResponseField type="Baseline">
  Baseline instance
</ResponseField>

## *classmethod* list()

Get a list of all baselines of a model.

### Returns

`Iterator[Baseline]`

## create()

Create a new baseline.

### Returns

`Baseline`

## delete()

Delete a baseline.
