snorkelflow.sdk.Slice
- class snorkelflow.sdk.Slice(dataset, slice_uid, name, description=None)
Bases:
object- __init__(dataset, slice_uid, name, description=None)
Create a Slice object in-memory with necessary properties. This constructor should not be called directly, and should instead be accessed through the
create()andget()methodsParameters
Parameters
Name Type Default Info dataset Union[str, int]The UID or name for the dataset within Snorkel Flow. slice_uid intThe UID for the slice within Snorkel Flow. name strThe name of the slice. description Optional[str]NoneThe description of the slice.
\_\_init\_\_
__init__
Methods
__init__(dataset, slice_uid, name[, description])Create a Slice object in-memory with necessary properties. add_x_uids(x_uids)Add datapoints to a slice. create(dataset, name[, description])Create a slice for a dataset. get(dataset, slice)Retrieve a slice by UID. get_x_uids()Retrieve the UIDs of the datapoints in the slice. list(dataset)Retrieve all slices for a dataset. remove_x_uids(x_uids)Remove datapoints from a slice. Attributes
dataset_uidReturn the UID of the dataset that the slice belongs to descriptionReturn the description of the slice nameReturn the name of the slice slice_uidReturn the UID of the slice - add_x_uids(x_uids)
Add datapoints to a slice.
add\_x\_uids
add_x_uids
- classmethod create(dataset, name, description='')
Create a slice for a dataset.
create
create
- classmethod get(dataset, slice)
Retrieve a slice by UID.
get
get
- get_x_uids()
Retrieve the UIDs of the datapoints in the slice.
get\_x\_uids
get_x_uids
- classmethod list(dataset)
Retrieve all slices for a dataset.
list
list
- remove_x_uids(x_uids)
Remove datapoints from a slice.
remove\_x\_uids
remove_x_uids
- property dataset_uid: int
Return the UID of the dataset that the slice belongs to
- property description: str | None
Return the description of the slice
- property name: str
Return the name of the slice
- property slice_uid: int
Return the UID of the slice