A segment, sometimes referred to as a cohort or slice, represents a distinct subset of model values crucial for performance analysis and troubleshooting. Model segments can be defined using various model dimensions, such as specific time periods or sets of features. Analyzing segments proves invaluable for understanding or troubleshooting specific cohorts of interest, particularly in tasks like bias detection, where overarching datasets might obscure statistical intricacies.

How to Define a Segment

Fiddler makes it easy to define custom segments using either the Fiddler UI or the Fiddler Python client. Instructions for both approaches are covered in more detail below. In either case, Fiddler Segments are constructed using the Fiddler Query Language (FQL).

You can use any of the constants, operators, and functions mentioned in the page linked above in a Segment definition.

However, every Segment definition must return a boolean row-level expression. In other words, each inference will either satisfy the segment expression and thus belong to the segment or it will not.


Let us illustrate further by providing a few examples. A segment can be defined by:

  • A condition on some column (e.g. age > 50)

  • A condition on some combination of columns (e.g. (age / max_age) < 1.0)

For details on all supported functions, see the Fiddler Query Language (FQL) page.

Adding a Segment

To learn more about adding a Segment using the Python client, see fdl.Segment.create()


PROJECT = fdl.Project.from_name(name=PROJECT_NAME)
MODEL = fdl.Model.from_name(name=MODEL_NAME,

segment = fdl.Segment(
        definition="Age < 60", #Use Fiddler Query Languge (FQL) to define your custom segments
        description='Users with Age under 60',

Modifying Segments

Since alerts can be set on Segments, making modifications to a Segment may introduce inconsistencies in alerts.

🚧 Therefore, Segments cannot be modified once they are created.

If you'd like to try out a new Segment, you can create a new one with a different Definition.

Last updated

© 2024 Fiddler AI