3. Adding Selectors to Auswahl

In general the extension of Auswahl with custom selector algorithms only requires extending the appropriate base class PointSelector or IntervalSelector and their proper initialization. The implementation of the member function _fit() is required. After the selector has been fitted on data, the instance must however possess the attribute support_, an array of flags indicating the selected features, and the attribute best_model_, which is an instance of the regression model underlying the selector fitted on the selected features.

The baseclass SpectralSelector provides the method evaluate(), which allows easy evaluation of the underlying regressor models on data with projections on different features. A cross-validation and hyperparameter optimization of the regressor can be optionally conducted.

3.1. PointSelector to IntervalSelector conversion

If the custom selector algorithm does not only calculate a specific selection of features, but produces a weight (greater better) for each feature, the selector can be made accessible to an algorithmic converion from a PointSelector to IntervalSelector by making the custom selector additionally extend the class Convertible. The extension requires the implementation of the member function get_feature_scores(). The custom selector can then be passed as argument to an instance of PseudoIntervalSelector. An example is given for the Convertible extending selector VIP:

from auswahl import VIP, PseudoIntervalSelector

vip = VIP()
interval_vip = PseudoIntervalSelector(selector=vip, n_intervals_to_select=10, interval_width=5)

The conversion is handled by a dynamic program optimizing the placements of intervals into the range of features, which maximizes the overall weight of the features covered by the intervals.

3.2. Preparing the selector for benchmarking

If the custom selector is to be used in the function benchmark() further implementations and overridings are to be considered. If the selector comprises a composite internal structure, that is, if it contains other selector algorithms as subalgorithms in its own selection approach, the following functions need to be overridden

An example of such overrides can be seen in VIP_SPA.