pasteur.hierarchy.RebalancedValue#
- class pasteur.hierarchy.RebalancedValue(counts, col, *, reshape_domain=True, u=1.3, fixed=[2, 4, 5, 8, 12], c=None, **_)[source]#
Attributes
Returns the maximum height of this value.
Methods
downsample(value, height)Receives an array named value and downsamples it based on the provided height, by grouping certain values together.
get_domain(height)Returns the domain of the attribute in the given height.
get_domain_multiple(heights, vals)Returns a list of human readable values for each discrete value.
get_mapping(height)Returns a numpy array that associates discrete values with groups at the given height.
get_mapping_multiple(heights, common, vals)get_naive_mapping_multiple(heights, common, vals)Returns whether this value is ordinal, other than for the elements it shares in common with the other attributes.
prefix_rename(prefix)rename(name[, name_cnt])upsample(column, height[, deterministic])Does the opposite of downsample.
- property domain#
- downsample(value, height)#
Receives an array named value and downsamples it based on the provided height, by grouping certain values together. The proper implementation is provided by pasteur.hierarchy.
- get_domain(height)[source]#
Returns the domain of the attribute in the given height.
- Return type:
int
- get_human_readable()#
Returns a list of human readable values for each discrete value.
- Return type:
list[str|int|float]
- get_mapping(height)[source]#
Returns a numpy array that associates discrete values with groups at the given height.
- Return type:
ndarray
- property height: int#
Returns the maximum height of this value.
-
ignore_nan:
bool#
- is_ordinal()[source]#
Returns whether this value is ordinal, other than for the elements it shares in common with the other attributes.
- Return type:
bool
-
name:
str#
- upsample(column, height, deterministic=True)[source]#
Does the opposite of downsample. If deterministic is True, for each group at a given height one of its values is chosen arbitrarily to represent all children of the group.
If deterministic is False, the group is sampled based on this Value’s histogram (not implemented in this class; see pasteur.hierarchy).