fab.hme.common package

Submodules

fab.hme.common.hme_validate module

fab.hme.common.hme_validate.validate_feature_ids_range(num_features, gate_feature_ids, comp_feature_ids, comp_mandatory_feature_ids=None, comp_positive_feature_ids=None, comp_negative_feature_ids=None)

Checks the validity of feature IDs with the number of features.

Parameters:
num_featuresint

The number of features in the given data.

gate_feature_idsNone or list[int]

Feature IDs for gate parameter optimization.

comp_feature_idsNone or list[int]

Feature IDs for component parameter optimization.

comp_mandatory_feature_idsNone or list[int]

Feature IDs for component parameter optimization with non-L0-regularize constraint.

comp_positive_feature_idsNone or list[int]

Feature IDs for component parameter optimization positive value constraint.

comp_negative_feature_idsNone or list[int]

Feature IDs for component parameter optimization negative value constraint.

Returns:
None
Raises:
ValueError

Specified feature IDs are out of range.

fab.hme.common.hme_validate.validate_multi_feature_ids(target_name, feature_ids, mandatory_feature_ids=None, positive_feature_ids=None, negative_feature_ids=None, accept_ids_empty=False)

Checks the validity of feature_ids parameters.

Parameters:
target_namestr = {‘gate’ or ‘comp’}

Target name to be validate. This is used for string message in the exception object.

feature_idsNone or list[int]

Feature IDs object (gate_feature_ids or comp_feature_ids).

mandatory_feature_idsNone or list[int], optional [default: None]

Feature IDs which non-L0-regularize constraint is applied to.

positive_feature_idsNone or list[int], optional [default: None]

Feature IDs which negative value constraint is applied to.

negative_feature_idsNone or list[int], optional [default: None]

Feature IDs which positive value constraint is applied to.

accept_ids_emptybool, optional [default: False]
If True, empty list ([]) is acceptable for only feature_ids

(not acceptable for {mandatory, positive, negative}_feature_ids).

Returns:
None
Raises:
TypeError

Type of specified feature IDs is unsupported.

ValueError

Specified feature IDs are out of range.

fab.hme.common.hme_validate.validate_posterior_params(posterior_prob, comp_ids)

Checks the validity of the posterior parameters.

Parameters:
posterior_probnp.ndarray, size = (num_samples, num_comps)

Posterior probability matrix whose validity is checked.

comp_idslist[int], size = (num_comps)

Component ID list whose validity is checked.

Returns:
None
Raises:
TypeError

Data types are not supported. Data type of the values in the matrix are unsupported. Dimensionality of the posterior probability is unsupported.

ValueError

Posterior probability values are out of range. Component ID list is empty. A non-integer or an out-of-range ID exists in the list. The number of components for posterior_prob and comp_ids are inconsistent.

fab.hme.common.split_feature_data module

fab.hme.common.split_feature_data.split_feature_data(X, split_indices)

Create feature data with only specified features from the whole input feature data.

It is assumed that input feature data is in a column major (‘F’-order) matrix.

Parameters:
Xnp.ndarray, size = (num_samples, num_features)

Input feature data.

split_indicesNone or list[int]

List of feature indices applied to the optimization. If None, it is equivalent to that all features are specified in the list.

Returns:
X_slicednp.ndarray, size = (num_features, len(split_indices))

Extracted feature data including only specified features.

Module contents