GreedySelector#

class equisolve.numpy._selection.GreedySelector(selector_class: Type[GreedySelector], selection_type: str, n_to_select: int | dict, **selector_arguments)[source]#

Wraps skmatter._selection.GreedySelector for a TensorMap.

The class creates a selector for each block. The selection will be done based the values of each TensorBlock. Gradients will not be considered for the selection.

fit(X: TensorMap, warm_start: bool = False) None[source]#

Learn the features to select.

Parameters:
  • X – Training vectors.

  • warm_start – Whether the fit should continue after having already run, after increasing n_to_select. Assumes it is called with the same X.

fit_transform(X: TensorMap, warm_start: bool = False) TensorMap[source]#

Fit to data, then transform it.

Parameters:
  • X – Training vectors.

  • warm_start – Whether the fit should continue after having already run, after increasing n_to_select. Assumes it is called with the same X.

property get_select_distance: TensorMap#

TensorMap containing the Hausdorff distances. For each block, the metadata of the relevant axis (i.e. samples or properties, depending on whether sample or feature selection is being performed) is sorted according to the Hausdorff distance, in descending order.

property selection_type: str#

Whether to choose a subset of columns (‘feature’) or rows (‘sample’).

property selector_arguments: dict#

Arguments passed to the selector_class.

property selector_class: Type[GreedySelector]#

The class to perform the selection.

property support: TensorMap#

TensorMap containing the support.

transform(X: TensorMap) TensorMap[source]#

Reduce X to the selected features.

Parameters:

X – The input tensor.

Returns:

The selected subset of the input.