iguanas.rule_scoring.RuleScorer

class iguanas.rule_scoring.RuleScorer(scoring_class: Union[iguanas.rule_scoring.rule_scoring_methods.PerformanceScorer, iguanas.rule_scoring.rule_scoring_methods.LogRegScorer, iguanas.rule_scoring.rule_scoring_methods.RandomForestScorer], scaling_class=None)[source]

Generates rule scores using the rule binary columns and the target column.

Parameters
scoring_classUnion[PerformanceScorer, LogRegScorer, RandomForestScorer]

The instantiated scoring class - this defines the method for generating the scores. Scoring classes are available in the rule_scoring_methods module.

scaling_classUnion[MinMaxScaler, ConstantScaler], optional

The instantiated scaling class - this defines the method for scaling the raw scores from the scoring class. Scaling classes are available in the rule_score_scalers module. Defaults to None.

Attributes
rule_scoresDict[str, int]

Contains the generated score (values) for each rule (keys).

fit(X_rules: iguanas.utils.typing.pandas.core.frame.DataFrame, y: iguanas.utils.typing.pandas.core.series.Series, sample_weight=None) None[source]

Generates rule scores using the rule binary columns and the binary target column.

Parameters
X_rulesPandasDataFrameType

The rule binary columns.

yPandasSeriesType

The binary target column.

sample_weightPandasSeriesType, optional

Row-wise weights to apply in the scoring_class. Defaults to None.

transform(X_rules: iguanas.utils.typing.pandas.core.frame.DataFrame) iguanas.utils.typing.pandas.core.frame.DataFrame[source]

Transforms the rule binary columns to show the generated scores applied to the dataset (i.e. replaces the 1 in X_rules with the generated score).

Parameters
X_rulesPandasDataFrameType

The rule binary columns.

Returns
PandasDataFrameType

The generated scores applied to the dataset.

fit_transform(X_rules: iguanas.utils.typing.pandas.core.frame.DataFrame, y: iguanas.utils.typing.pandas.core.series.Series, sample_weight=None) iguanas.utils.typing.pandas.core.frame.DataFrame[source]

Generates rule scores using the rule binary columns and the binary target column, then transforms the rule binary columns to show the generated scores applied to the dataset (i.e. replaces the 1 in X_rules with the generated score).

Parameters
X_rulesPandasDataFrameType

The rule binary columns.

yPandasSeriesType

The binary target column.

sample_weightPandasSeriesType, optional

Row-wise weights to apply in the scoring_class. Defaults to None.

Returns
PandasDataFrameType

The generated scores applied to the dataset.