ChiSquaredFeatureSelection
extends FeatureSelection
in package
A subclass of FeatureSelection that implements chi-squared feature selection.
This feature selection method scores each feature according to its informativeness, then selects the top N most informative features, where N is a run-time parameter.
Tags
Table of Contents
- $max : int
- The maximum number of features to select, a runtime parameter.
- __construct() : mixed
- Sets any passed runtime parameters.
- buildMap() : array<string|int, mixed>
- Constructs a map from old feature indices to new ones according to a max-heap of the most informative features. Always keep feature index 0, which is used as an intercept term.
- select() : array<string|int, mixed>
- Uses the chi-squared feature selection algorithm to rank features by informativeness, and return a map from old feature indices to new ones.
Properties
$max
The maximum number of features to select, a runtime parameter.
public
int
$max
Methods
__construct()
Sets any passed runtime parameters.
public
__construct([array<string|int, mixed> $parameters = [] ]) : mixed
Parameters
- $parameters : array<string|int, mixed> = []
-
optional associative array of parameters to replace the default ones with
Return values
mixed —buildMap()
Constructs a map from old feature indices to new ones according to a max-heap of the most informative features. Always keep feature index 0, which is used as an intercept term.
public
buildMap(object $selected) : array<string|int, mixed>
Parameters
- $selected : object
-
max heap containing entries ordered by informativeness and feature index.
Return values
array<string|int, mixed> —associative array mapping a subset of the original feature indices to the new indices
select()
Uses the chi-squared feature selection algorithm to rank features by informativeness, and return a map from old feature indices to new ones.
public
select(object $features) : array<string|int, mixed>
Parameters
- $features : object
-
full feature set
Return values
array<string|int, mixed> —associative array mapping a subset of the original feature indices to new indices