K Best Feature Selector#

A supervised feature selector that picks the top K ranked features returned by a learner implementing the RanksFeatures interface.

Note: The default feature ranking base learner is a fully-grown decision tree.

Interfaces: Transformer, Stateful, Persistable

Data Type Compatibility: Depends on the base learner


# Param Default Type Description
1 k int The maximum number of features to select from the dataset.
2 scorer Auto RanksFeatures The base feature scorer.

Additional Methods#

Return the final importances of the selected feature columns:

public importances() : ?array


use Rubix\ML\Transformers\KBestFeatureSelector;
use Rubix\ML\Regressors\GradientBoost;

$transformer = new KBestFeatureSelector(10, new GradientBoost());