FeatureSelection
in package
This is an abstract class that specifies an interface for selecting top features from a dataset.
Each FeatureSelection class implements a select method that takes a Features instance and returns a mapping from a subset of the old feature indices to new ones.
Tags
Table of Contents
- __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>
- Computes the top features of a Features instance, and returns a mapping from a subset of those features to new contiguous indices. The mapping allows documents that have already been mapped into the larger feature space to be converted to the smaller feature space, while keeping the feature indices contiguous (e.g., 1, 2, 3, 4, ... instead of 22, 35, 75, ...).
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()
Computes the top features of a Features instance, and returns a mapping from a subset of those features to new contiguous indices. The mapping allows documents that have already been mapped into the larger feature space to be converted to the smaller feature space, while keeping the feature indices contiguous (e.g., 1, 2, 3, 4, ... instead of 22, 35, 75, ...).
public
abstract select(object $features) : array<string|int, mixed>
Parameters
- $features : object
-
Features instance
Return values
array<string|int, mixed> —associative array mapping a subset of the original feature indices to new indices