dataset¶
- class AnnotatedDataset(groups, *, target, observations, categories, background_category)¶
Bases:
Dataset,AnnotatedSampleableMixinAnnotated dataset.
- Parameters:
groups (
Mapping[str|int,Group]) – The groups of individuals in the dataset.target (
Literal['individual','dyad']) – The target of the dataset.observations (
DataFrame) – The observations of the dataset.categories (
tuple[str,...]) – The categories of the dataset.background_category (
str) – The background category of the dataset.
- class Dataset(groups, *, target)¶
Bases:
NestedSampleableMixin,SampleableMixinA dataset is a collection of groups (
Group), each of which is a collection of individuals (Individual) or dyads (Dyad).- Parameters:
- classmethod REQUIRED_COLUMNS(target=None)¶
Returns the required columns for annotations with the given target.
- Parameters:
target (
Literal['individual','dyad'] |None, default:None) – The target type for the annotations.- Return type:
tuple[Literal['group'],Literal['actor'],Literal['category'],Literal['start'],Literal['stop']] |tuple[Literal['group'],Literal['actor'],Literal['recipient'],Literal['category'],Literal['start'],Literal['stop']]- Returns:
The required columns for annotations.
- annotate(observations, *, categories, background_category)¶
Annotates the dataset with the given observations.
- exclude_individuals(individuals, *, subset_actors_only=True)¶
Exclude individuals from the dataset.
- Parameters:
individuals (
Sequence[str|int|tuple[str|int,str|int]]) – The individuals to exclude.subset_actors_only (
bool, default:True) – Whether to exclude only actors iftarget="dyad". This drops all dyads involving the excluded individuals as actors. Otherwise, all dyads that involve excluded individuals (as either actor or recipient) are dropped.
- Return type:
Self- Returns:
The dataset with the excluded individuals.
- classmethod from_groups(groups)¶
Create a new dataset from a groups.
- property individuals: tuple[tuple[str | int, str | int], ...]¶
Returns a tuple of all subjects (individuals in groups) in the dataset.
- k_fold(k, *, random_state, subset_actors_only=True)¶
Yields a generator of k-fold splits.
- Parameters:
- Yields:
A generator of k-fold splits.
- Return type:
See also
exclude_individuals()for more details on thesubset_actors_onlyparameter.
- split(size, *, random_state, subset_actors_only=True)¶
Split the dataset into two subsets.
- Parameters:
- Return type:
tuple[Self,Self]- Returns:
A tuple of two subsets.
See also
exclude_individuals()for more details on thesubset_actors_onlyparameter.
- include(individual, exclude)¶
Check if an individual (i.e., subject, individual of a group in a dataset) should be included.