decision_rules.helpers package

decision_rules.helpers.dataset_transformer

Contains helpers classes.

class decision_rules.helpers.dataset_transformer.ConditionalDatasetTransformer(conditions: Iterable[AbstractCondition])

Bases: object

Helper class transforming dataset with given set of conditions. It produces binary dataset showing conditions coverage.

class Methods(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Methods of how to extract conditions from rules.

Parameters:

Enum (_type_) – _description_

NESTED: str = 'nested'
SPLIT: str = 'split'
TOP_LEVEL: str = 'top_level'
transform(X: ndarray, column_names: Iterable[str], method: Methods = 'top_level') DataFrame

Transform dataset with set of conditions producing binary dataset.

Parameters:
  • X (np.ndarray) – X

  • column_names (list[str]) – names of columns

  • method (ConditionalDatasetTransformer.Methods) – controls how to generate colums. “top_level”: passed conditions as columns, “split”: passed conditions and their subconditions as columns, “nested”: all passed conditions and their subconditions recursivly

Returns:

transformed binary dataset

Return type:

pd.DataFrame

decision_rules.helpers.measures

decision_rules.helpers.measures.get_measure_function_by_name(measure_name: str) Callable[[Coverage], float]

Returns function that calculates quality measure for given measure name

Parameters:

measure_name (str) – Name of the quality measure in snake case or camel case

Raises:

ValueError – If measure is not supported by the package

Returns:

Quality measure funciton

Return type:

Callable[[Coverage], float]

decision_rules.helpers.p_values

decision_rules.helpers.p_values.correct_p_values_fdr(p_values: list) list

Adjust p-values using the False Discovery Rate (FDR) method.

Parameters:

p_values (list) – List of p-values to be adjusted.

Returns:

List of adjusted p-values, maintaining the original order.

Return type:

list

decision_rules.helpers.p_values.get_significant_fraction(p_values: list[float], significance_level: float) float

Calculates the fraction of significant rules based on the p-values.

Parameters:
  • p_values (list[float]) – List of p-values.

  • significance_level (float) – The significance level.

Returns:

The fraction of significant rules.

Return type:

float