VarianceThreshold

class ibex.sklearn.feature_selection.VarianceThreshold(threshold=0.0)

Bases: sklearn.feature_selection.variance_threshold.VarianceThreshold, ibex._base.FrameMixin

Note

The documentation following is of the class wrapped by this class. There are some changes, in particular:

Feature selector that removes all low-variance features.

This feature selection algorithm looks only at the features (X), not the desired outputs (y), and can thus be used for unsupervised learning.

Read more in the User Guide.

threshold : float, optional
Features with a training-set variance lower than this threshold will be removed. The default is to keep all features with non-zero variance, i.e. remove the features that have the same value in all samples.
variances_ : array, shape (n_features,)
Variances of individual features.

The following dataset has integer features, two of which are the same in every sample. These are removed with the default setting for threshold:

>>> X = [[0, 2, 0, 3], [0, 1, 4, 3], [0, 1, 1, 3]]
>>> selector = VarianceThreshold()
>>> selector.fit_transform(X)
array([[2, 0],
       [1, 4],
       [1, 1]])
fit(X, y=None)[source]

Note

The documentation following is of the class wrapped by this class. There are some changes, in particular:

Learn empirical variances from X.

X : {array-like, sparse matrix}, shape (n_samples, n_features)
Sample vectors from which to compute variances.
y : any
Ignored. This parameter exists only for compatibility with sklearn.pipeline.Pipeline.

self

fit_transform(X, y=None, **fit_params)

Note

The documentation following is of the class wrapped by this class. There are some changes, in particular:

Fit to data, then transform it.

Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X.

X : numpy array of shape [n_samples, n_features]
Training set.
y : numpy array of shape [n_samples]
Target values.
X_new : numpy array of shape [n_samples, n_features_new]
Transformed array.
inverse_transform(X)

Note

The documentation following is of the class wrapped by this class. There are some changes, in particular:

Reverse the transformation operation

X : array of shape [n_samples, n_selected_features]
The input samples.
X_r : array of shape [n_samples, n_original_features]
X with columns of zeros inserted where features would have been removed by transform.
transform(X)

Note

The documentation following is of the class wrapped by this class. There are some changes, in particular:

Reduce X to the selected features.

X : array of shape [n_samples, n_features]
The input samples.
X_r : array of shape [n_samples, n_selected_features]
The input samples with only the selected features.