pasteur.attribute.CatValue#

class pasteur.attribute.CatValue[source]#

Class for a Categorical Value.

Each Categorical Value is represented by an unsigned integer. It can also group its different values together based on an integer parameter named height. The implementation of this class remains abstract, and is expanded in the StratifiedValue class.

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)[source]#

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=0)[source]#

Returns the domain of the attribute in the given height.

Return type:

int

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.

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()[source]#
Return type:

int

upsample(value, 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).