Skip to content

BackwardSelectionFeatureSelector

BackwardSelectionFeatureSelector dataclass

BackwardSelectionFeatureSelector(
    objective_metric: Optional[str] = None,
    maximize_objective: Optional[bool] = None,
    removal_ratio: Optional[float] = None,
    removal_count: Optional[int] = None,
    variable_importance: Optional[str] = None,
    allow_structural_variable_importance: bool = False,
    allow_model_self_evaluation_and_variable_importances: bool = True,
)

Bases: AbstractFeatureSelector

Greedy backward feature selector.

Attributes:

Name Type Description
removal_ratio Optional[float]

Ratio of the features are removed at each iteration. The smaller the value, the more accurate but the more expensive the results. Note that at lease one feature is removed at each round. Only one of removal_ratio and removal_count can be specified. If neither removal_ratio and removal_count is specified, removal_ratio defaults to 0.1.

removal_count Optional[int]

Number of the features are removed at each iteration. The smaller the value, the more accurate but the more expensive the results. Only one of removal_ratio and removal_count can be specified.

variable_importance Optional[str]

Name of the variable importance used to drive the feature selection. Should be one of the keys of model.variable_importances(). If None, a reasonable variable importance is selected automatically.

allow_structural_variable_importance bool

If True, structural variable importances can be used to drive to the feature selection. If false and if only structural variable importances are available, raises an error.

allow_model_self_evaluation_and_variable_importances bool

If True, and if the model produces a self evaluation and corresponding variable importances, use those values directly. If false, use the provided validation dataset to evaluate and compute the variable importances of the model.

allow_model_self_evaluation_and_variable_importances class-attribute instance-attribute

allow_model_self_evaluation_and_variable_importances: (
    bool
) = True

allow_structural_variable_importance class-attribute instance-attribute

allow_structural_variable_importance: bool = False

maximize_objective class-attribute instance-attribute

maximize_objective: Optional[bool] = None

objective_metric class-attribute instance-attribute

objective_metric: Optional[str] = None

removal_count class-attribute instance-attribute

removal_count: Optional[int] = None

removal_ratio class-attribute instance-attribute

removal_ratio: Optional[float] = None

variable_importance class-attribute instance-attribute

variable_importance: Optional[str] = None

get_objective_score

get_objective_score(
    evaluation: Dict[str, Any],
) -> Tuple[float, str]

Gets the score of a metric to optimize. The greater the better.

run

run(
    learner: GenericLearner,
    ds: InputDataset,
    valid: Optional[InputDataset] = None,
    verbose: Optional[Union[int, bool]] = None,
) -> ModelType

Runs the feature selector.