pasteur.attribute.StratifiedValue#

class pasteur.attribute.StratifiedValue(head, common=0)[source]#

A version of CategoricalValue which uses a Stratification to represent the domain knowledge of the Value.

Each unique value is mapped to a tree with nodes where the child order matters. By traversing the tree in DFS, each leaf is mapped to an integer.

Attributes

common

domain

height

Returns the maximum height of this value.

name

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_mapping(height)

Returns a numpy array that associates discrete values with groups at the given height.

is_ordinal()

Returns whether this value is ordinal, other than for the elements it shares in common with the other attributes.

select_height()

rtype:

int

upsample(value, height[, deterministic])

Does the opposite of downsample.

common: int = 0#
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.

get_mapping(height)[source]#

Returns a numpy array that associates discrete values with groups at the given height.

property height#

Returns the maximum height of this value.

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#
select_height()#
Return type:

int

upsample(value, height, deterministic=True)#

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).