backbone_learn.screen_selectors package

Submodules

backbone_learn.screen_selectors.linear_regression_selector module

class backbone_learn.screen_selectors.linear_regression_selector.LinearRegressionSelector(alpha: float = 1.0)[source]

Bases: ScreenSelectorBase

Screen selector that uses linear regression coefficients for calculating utilities.

calculate_utilities(X: ndarray, y: ndarray) ndarray[source]

Calculate utilities based on the coefficients of a linear regression model.

backbone_learn.screen_selectors.pearson_correlation_selector module

class backbone_learn.screen_selectors.pearson_correlation_selector.PearsonCorrelationSelector(alpha: float = 1.0)[source]

Bases: ScreenSelectorBase

Screen selector that uses Pearson correlation for calculating utilities.

calculate_utilities(X: ndarray, y: ndarray) ndarray[source]

Calculate utilities based on Pearson correlation.

static compute_covariance(x: ndarray, y: ndarray, x_mean: float, y_mean: float) float[source]

Compute the covariance between two numpy arrays.

static compute_mean(array: ndarray) float[source]

Compute the mean of a numpy array.

static compute_std(array: ndarray) float[source]

Compute the standard deviation of a numpy array.

backbone_learn.screen_selectors.screen_selector_base module

class backbone_learn.screen_selectors.screen_selector_base.ScreenSelectorBase(alpha: float = 1.0)[source]

Bases: VariableSelector

Abstract base class for screen selectors.

abstract calculate_utilities(X: ndarray, y: ndarray) ndarray[source]

Calculate the utilities for each feature.

Parameters
  • X (np.ndarray) – The feature matrix.

  • y (np.ndarray) – The target array.

Returns

This method should return the utilities

Return type

np.ndarray

select(X: ndarray, y: ndarray) ndarray[source]

Selects features based on calculated utilities and alpha value.

Parameters
  • X (np.ndarray) – The feature matrix.

  • y (np.ndarray) – The target array.

Returns

The selected feature matrix.

Return type

np.ndarray

static select_indices(utilities: ndarray, num_keep: int) ndarray[source]

Selects indices of the top utilities.

Parameters
  • utilities (np.ndarray) – Array of utilities for each feature.

  • num_keep (int) – Number of top features to keep.

Returns

Indices of the top utilities.

Return type

np.ndarray

backbone_learn.screen_selectors.variable_selector module

class backbone_learn.screen_selectors.variable_selector.VariableSelector[source]

Bases: ABC

Abstract base class for variable selectors.

abstract select(X: ndarray, y: ndarray) ndarray[source]

Abstract method to select features.

Parameters
  • X (np.ndarray) – The feature matrix.

  • y (np.ndarray) – The target array.

Returns

The selected feature matrix.

Return type

np.ndarray

Module contents