Documentation of decision_rules
decision_rules.conditions
Contains logical conditions classes.
- class decision_rules.conditions.AttributesCondition(column_left: int, column_right: int, operator: str)
Bases:
AbstractConditionCondition specifying a relation between two attributes (columns). Possible relations are: =, !=, >, <
- Example in rule:
IF petal_length > sepal_width THEN y = 1
- property attributes: frozenset[int]
Returns: frozenset[int]: condition attributes
- to_string(columns_names: str) str
- Parameters:
columns_names (list[str])
- Returns:
condition string representation
- Return type:
str
- class decision_rules.conditions.CompoundCondition(subconditions: list[ElementaryCondition], logic_operator: LogicOperators = LogicOperators.CONJUNCTION)
Bases:
AbstractConditionCondition specyfing logical conjunction or alternative of other conditions.
- Example in rule:
IF petal_length = <-0.015, 0.185> AND sepal_width = <-0.047, 0.253> THEN y = 1
- property attributes: frozenset[int]
Returns: frozenset[int]: condition attributes
- to_string(columns_names: list[str]) str
- Parameters:
columns_names (list[str])
- Returns:
condition string representation
- Return type:
str
- class decision_rules.conditions.ElementaryCondition(column_index: int, left: float = -inf, right: float = inf, left_closed: bool = False, right_closed: bool = False)
Bases:
AbstractConditionNumerical attributes condition.
- It has left and right boundary and takes following form:
{LEFT} < {ATTRIBUTE} < {RIGHT}
- Example in rule:
IF petal_length = <-0.015, 0.185> THEN y = 1
- property attributes: frozenset[int]
Returns: frozenset[int]: condition attributes
- to_string(columns_names: str) str
- Parameters:
columns_names (list[str])
- Returns:
condition string representation
- Return type:
str
- class decision_rules.conditions.LogicOperators(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
Enum- ALTERNATIVE = 'ALTERNATIVE'
- CONJUNCTION = 'CONJUNCTION'
- class decision_rules.conditions.NominalCondition(column_index: int, value: str)
Bases:
AbstractConditionClass for elementary condition for nominal attributes.
It takes following form:
IF {ATTRIBUTE} = {VALUE} THEN y = {DECISION}
Example
IF gender = 1 THEN y = 1
- property attributes: frozenset[int]
Returns: frozenset[int]: condition attributes
- to_string(columns_names: list[str]) str
- Parameters:
columns_names (list[str])
- Returns:
condition string representation
- Return type:
str
decision_rules.histogram
- class decision_rules.histogram.Histograms(*, min: int, max: int, bin_edges: list[float], histograms: dict[str, list[int]])
Bases:
BaseModel- bin_edges: list[float]
- histograms: dict[str, list[int]]
- max: int
- min: int
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'bin_edges': FieldInfo(annotation=list[float], required=True), 'histograms': FieldInfo(annotation=dict[str, list[int]], required=True), 'max': FieldInfo(annotation=int, required=True), 'min': FieldInfo(annotation=int, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- decision_rules.histogram.get_histograms(model: AbstractRuleSet, dataset: DataFrame, problem_type: ProblemTypes, bins: int, for_rules: list[str] = ()) Histograms
decision_rules.measures
Contains functions for calculating different qualities measures. They can be used for calculating rule qualities and voting weights
decision_rules.problem
decision_rules.settings
Contains global configuration conditions classes.
- decision_rules.settings.FLOAT_DISPLAY_PRECISION
controls floating points numbers precision when displaying rules as strings.
- Type:
str
- decision_rules.settings.CONCISE_NUMERICAL_CONDITIONS_FORM
If set to true, string representations of numerical elementary conditions where one of the interval boundary is +/- infinity will be writen in more concise form of “X < right” or “X > left” instead of the full form: “X = <left, right)”
- Type:
bool