deephyper.ensemble.selector.TopKSelector

deephyper.ensemble.selector.TopKSelector#

class deephyper.ensemble.selector.TopKSelector(loss_func: Callable | Loss, k: int = 5)[source]#

Bases: Selector

Selection method implementing Top-K selection. This method selects the K predictors with the lowest loss.

Parameters:
  • loss_func (Callable or Loss) – a loss function that takes two arguments: the true target values and the predicted target values.

  • k (int, optional) – The number of predictors to select. Defaults to 5.

Methods

select

The selection algorithms.

select(y, y_predictors) Sequence[int][source]#

The selection algorithms.

Parameters:
  • y (np.ndarray) – the true target values.

  • y_predictors (_type_) – a sequence of predictions from available predictors. It should be a list of length n_predictors with each element being the prediction of a predictor.

Returns:

the sequence of selected predictors. Sequence[float]: the sequence of weights associated to the selected predictors.

Return type:

Sequence[int]