PREDICT.featureselection package

Submodules

PREDICT.featureselection.Relief module

class PREDICT.featureselection.Relief.SelectMulticlassRelief(n_neighbours=3, sample_size=1, distance_p=2, numf=None)

Bases: sklearn.base.BaseEstimator, sklearn.feature_selection.base.SelectorMixin

Object to fit feature selection based on the type group the feature belongs to. The label for the feature is used for this procedure.

fit(X, y)

Select only features specificed by parameters per patient.

feature_values: numpy array, mandatory
Array containing feature values used for model_selection. Number of objects on first axis, features on second axis.
feature_labels: list, mandatory
Contains the labels of all features used. The index in this list will be used in the transform funtion to select features.
multi_class_relief(feature_set, label_set, nb=3, sample_size=1, distance_p=2, numf=None)
single_class_relief(feature_set, label_set, nb=3, sample_size=1, distance_p=2, numf=None)
transform(inputarray)

Transform the inputarray to select only the features based on the result from the fit function.

inputarray: numpy array, mandatory
Array containing the items to use selection on. The type of item in this list does not matter, e.g. floats, strings etc.

PREDICT.featureselection.SelectGroups module

class PREDICT.featureselection.SelectGroups.SelectGroups(parameters)

Bases: sklearn.base.BaseEstimator, sklearn.feature_selection.base.SelectorMixin

Object to fit feature selection based on the type group the feature belongs to. The label for the feature is used for this procedure.

fit(feature_labels)

Select only features specificed by parameters per patient.

feature_labels: list, optional
Contains the labels of all features used. The index in this list will be used in the transform funtion to select features.
transform(inputarray)

Transform the inputarray to select only the features based on the result from the fit function.

inputarray: numpy array, mandatory
Array containing the items to use selection on. The type of item in this list does not matter, e.g. floats, strings etc.

PREDICT.featureselection.SelectIndividuals module

class PREDICT.featureselection.SelectIndividuals.SelectIndividuals(parameters=['hf_mean', 'sf_compactness'])

Bases: sklearn.base.BaseEstimator, sklearn.feature_selection.base.SelectorMixin

Object to fit feature selection based on the type group the feature belongs to. The label for the feature is used for this procedure.

fit(feature_labels)

Select only features specificed by parameters per patient.

feature_labels: list, optional
Contains the labels of all features used. The index in this list will be used in the transform funtion to select features.
transform(inputarray)

Transform the inputarray to select only the features based on the result from the fit function.

inputarray: numpy array, mandatory
Array containing the items to use selection on. The type of item in this list does not matter, e.g. floats, strings etc.

PREDICT.featureselection.StatisticalTestThreshold module

class PREDICT.featureselection.StatisticalTestThreshold.StatisticalTestThreshold(metric='ttest', threshold=0.05)

Bases: sklearn.base.BaseEstimator, sklearn.feature_selection.base.SelectorMixin

Object to fit feature selection based on statistical tests.

fit(X_train, Y_train)

Select only features specificed by the metric and threshold per patient.

X_train: numpy array, mandatory
Array containing feature values used for model_selection. Number of objects on first axis, features on second axis.
Y_train: numpy array, mandatory
Array containing the binary labels for each object in X_train.
transform(inputarray)

Transform the inputarray to select only the features based on the result from the fit function.

inputarray: numpy array, mandatory
Array containing the items to use selection on. The type of item in this list does not matter, e.g. floats, strings etc.

PREDICT.featureselection.VarianceThreshold module

class PREDICT.featureselection.VarianceThreshold.VarianceThresholdMean(threshold)

Bases: sklearn.base.BaseEstimator, sklearn.feature_selection.base.SelectorMixin

Select features based on variance among objects. Similar to VarianceThreshold from sklearn, but does take the mean of the feature into account.

fit(image_features)
transform(inputarray)

Transform the inputarray to select only the features based on the result from the fit function. Parameters ———- inputarray: numpy array, mandatory

Array containing the items to use selection on. The type of item in this list does not matter, e.g. floats, strings etc.
PREDICT.featureselection.VarianceThreshold.selfeat_variance(image_features, labels=None, thresh=0.99, method='nomean')

Select features using a variance threshold.

image_features: numpy array, mandatory
Array containing the feature values to apply the variance threshold selection on. The rows correspond to the patients, the column to the features.
labels: numpy array, optional
Array containing the labels of the corresponding features. Array should therefore have the same shape as the image_features array.
thresh: float, default 0.99
Threshold to be used as lower boundary for feature variance among patients.
method: string, default nomean.
Method to use for selection. Default: do not use the mean of the features. Other valid option is ‘mean’.
image_features: numpy array
Transformed features array.
labels: list or None
When labels are given, returns the transformed labels. That object contains a list of all label names kept.
sel: VarianceThreshold object
The fitted variance threshold object.

Module contents