Model run slice
Developer guide for interacting with model slices using the Python SDK.
Model slices operate much like Catalog slices, both essentially functioning as saved searches that help filter large datasets into more manageable units. While Catalog slices function support Catalog, Model slices work within model runs. Model slices let you filter model run data rows into manageable units.
Here, we show how to use the SDK to:
- Create an experiment and a model run.
- Create a slice from model run data.
Example: create and retrieve model slice
Before you start
You must import these libraries to use the code examples in this section.
Replace the value of API_KEY
with a valid API key to connect to the Labelbox client.
Create a model experiment and a model run
To interact with model slices, you must create a model experiment with a model run and then create a model slice through the platform. The steps below go over this process. See Slices Slicesfor more information
Create a model experiment
To create a model experiment, you will need to create an ontology. See Ontology for more information
Attach the ontology during model creation.
Create a model run from a model experiment
In this step, you will need to create a dataset to attach data rows to our model run.
Create a model slice
Use the Labelbox app to create a model slice.
From Model, select Experiment and select your model experiment.
A filter must be active to create a slice. From the Search menu, select Data row and then set the Condition menu to is not one of.
Set Search for an id to test and then press Enter to activate the filter. You can add additional filter conditions as needed.
Example of final view after executing step 2 -3
Select Save slice, name your slice, and then select Save. When you do this, the Slice menu displays the name of your slice and the number of matching data rows.
From the Slice menu, select Copy slice ID.
Example of final view after executing step 4 - 6
Paste the Slice ID into your your code:
Get model slice
Obtain data row IDs from model slice
Data row identifiers are objects that contain both data row IDs and global keys.