iguanas.rule_application
.RuleApplier¶
- class iguanas.rule_application.RuleApplier(rule_strings: Dict[str, str], opt_func=None)[source]¶
Applies rules (stored in the standard Iguanas string format) to a dataset.
- Parameters
- rule_stringsDict[str, str]
Set of rules defined using the standard Iguanas string format (values) and their names (keys).
- opt_funcCallable, optional
A function/method which calculates a custom metric (e.g. Fbeta score) for each rule. Defaults to None.
- Attributes
- rule_descriptionsPandasDataFrameType
Contains the logic of the rules and their performance metrics as applied to the dataset.
- transform(X: Union[iguanas.utils.typing.pandas.core.frame.DataFrame, iguanas.utils.typing.databricks.koalas.frame.DataFrame], y=None, sample_weight=None) Union[iguanas.utils.typing.pandas.core.frame.DataFrame, iguanas.utils.typing.databricks.koalas.frame.DataFrame] [source]¶
Applies the set of rules to a dataset, X. If y is provided, the performance metrics for each rule will also be calculated.
- Parameters
- XUnion[PandasDataFrameType, KoalasDataFrameType]
The feature set on which the rules should be applied.
- yUnion[PandasSeriesType, KoalasSeriesType], optional
The target column. Defaults to None.
- sample_weightUnion[PandasSeriesType, KoalasSeriesType], optional
Record-wise weights to apply. Defaults to None.
- Returns
- Union[PandasDataFrameType, KoalasDataFrameType]
The binary columns of the rules.