quantlab.model.predefined.double_ensemble.select_features#

quantlab.model.predefined.double_ensemble.select_features(g, bins, sample_ratios, rng)[source]#

Qlib’s feature selection draw (DEnsembleModel.feature_selection) from the g-values.

The g-values (NaN read as 0) are cut into bins equal-width bins. The bins holding a feature are visited from the highest down, and the i-th of them gives ceil(sample_ratios[i] * size) of its features drawn without replacement. Returns the sorted column indices.

Examples

>>> select_features(np.array([0.9, 0.8, 0.1, 0.0, -0.5]), 2, [1.0, 0.5],
...                 np.random.default_rng(0)).tolist()
[0, 1, 2, 3]