iguanas.rule_selection
.SimpleFilter¶
- class iguanas.rule_selection.SimpleFilter(filters: Dict[str, Dict[str, Union[str, float]]], rule_descriptions=None, opt_func=None)[source]¶
Filter rules based on performance metrics.
- Parameters
- filtersDict[str, Dict[str, Union[str, float]]]
Gives the filtering metric (keys) and the filtering conditions (values). The filtering conditions are another dictionary containing the keys ‘Operator’ (which specifies the filter operator) and ‘Value’ (which specifies the value to filter by).
- rule_descriptionsPandasDataFrameType, optional
The standard performance metrics dataframe associated with the rules (if available). If not given, it will be calculated from X_rules. Defaults to None.
- opt_funcCallable, optional
The custom method/function to be applied to the rules (e.g. Fbeta score) if rule_descriptions is not given. Use the filtering metric key ‘OptMetric’ in the filters parameter if you need to filter by this metric. Defaults to None.
- Attributes
- rules_to_keepList[str]
List of rules which remain after the filters have been applied.
- fit(X_rules: iguanas.utils.typing.pandas.core.frame.DataFrame, y=None, sample_weight=None) None [source]¶
Calculates the rules remaining after the filters have been applied.
- Parameters
- X_rulesPandasDataFrameType
The binary columns of the rules applied to a dataset.
- yPandasSeriesType, optional
The binary target column. Not required if rule_descriptions is given. Defaults to None.
- sample_weightPandasSeriesType, optional
Row-wise weights to apply. Defaults to None.
- transform(X_rules: iguanas.utils.typing.pandas.core.frame.DataFrame) iguanas.utils.typing.pandas.core.frame.DataFrame [source]¶
Removes the filtered rules.
- Parameters
- X_rulesPandasDataFrameType
The binary columns of the rules applied to a dataset.
- Returns
- PandasDataFrameType
The filtered rule binary columns.
- fit_transform(X_rules: iguanas.utils.typing.pandas.core.frame.DataFrame, y=None, sample_weight=None) iguanas.utils.typing.pandas.core.frame.DataFrame [source]¶
Calculates the rules remaining after the filters have been applied, then removes the filtered rules.
- Parameters
- X_rulesPandasDataFrameType
The binary columns of the rules applied to a dataset.
- yPandasSeriesType, optional
The binary target column. Not required if rule_descriptions is given. Defaults to None.
- sample_weightPandasSeriesType, optional
Row-wise weights to apply. Defaults to None.
- Returns
- PandasDataFrameType
The filtered rule binary columns.