Data segment for targeted monitoring and cohort analysis. Segment defines subsets of model data based on specific criteria using SQL-like expressions. Segments enable cohort analysis, A/B testing evaluation, targeted monitoring of specific populations, and fairness analysis across different groups.Documentation Index
Fetch the complete documentation index at: https://handbook.fiddler.ai/llms.txt
Use this file to discover all available pages before exploring further.
Example
Segments are evaluated during data processing and can be used with any monitoring metric. Complex segment definitions may impact performance, so optimize for efficiency. Segments are particularly useful for fairness monitoring and business-critical cohort analysis.
create()
Create a new Segment on the Fiddler platform. Registers this Segment with the Fiddler platform. The expression must have a name, model_id, and definition specified before calling create().Returns
The same Segment instance with updated server-side attributes (id, created_at, etc.).Raises
- ApiError — If there’s an error communicating with the Fiddler API.
- Conflict — If a Segment with the same name already exists for this model.
delete()
Delete this Segment from the Fiddler platform. Permanently removes the Segment. This action cannot be undone. Any alert rules or monitors using this Segment must be deleted first.Raises
- NotFound — If the Segment no longer exists.
- ApiError — If there’s an error communicating with the Fiddler API.
- Conflict — If the Segment is still being used by alert rules or monitors. Return type: None
classmethod from_name(name, model_id)
Retrieve a Segment by name and model. Fetches a Segment from the Fiddler platform using its name and associated model ID.Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
name | str | ✗ | None | The name of the Segment to retrieve. |
model_id | `UUID | str` | ✗ | None |
Returns
The Segment instance for the provided parameters.Raises
- NotFound — If no Segment exists with the specified name and model.
- ApiError — If there’s an error communicating with the Fiddler API.
classmethod get(id_)
Retrieve a Segment by its unique identifier. Fetches a Segment from the Fiddler platform using its UUID.Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
id_ | `UUID | str` | ✗ | None |
Returns
The Segment instance with all its configuration and metadata.Raises
- NotFound — If no Segment exists with the specified ID.
- ApiError — If there’s an error communicating with the Fiddler API.
classmethod get_organization_id()
Get the organization UUID from the global connection.Returns
Unique identifier of the organization associated with the current connection. Return type: UUIDclassmethod get_organization_name()
Get the organization name from the global connection.Returns
Name of the organization associated with the current connection. Return type: strclassmethod list(model_id)
List all Segment instances for a model. Retrieves all Segment instances associated with a specific model.Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model_id | `UUID | str` | ✗ | None |