class sklearn.feature_selection.VarianceThreshold(threshold=0.0)
[source]
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.
Parameters: |
|
---|---|
Attributes: |
|
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]) | Learn empirical variances from X. |
fit_transform (X[, y]) | Fit to data, then transform it. |
get_params ([deep]) | Get parameters for this estimator. |
get_support ([indices]) | Get a mask, or integer index, of the features selected |
inverse_transform (X) | Reverse the transformation operation |
set_params (**params) | Set the parameters of this estimator. |
transform (X) | Reduce X to the selected features. |
__init__(threshold=0.0)
[source]
fit(X, y=None)
[source]
Learn empirical variances from X.
Parameters: |
|
---|---|
Returns: |
|
fit_transform(X, y=None, **fit_params)
[source]
Fit to data, then transform it.
Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X.
Parameters: |
|
---|---|
Returns: |
|
get_params(deep=True)
[source]
Get parameters for this estimator.
Parameters: |
|
---|---|
Returns: |
|
get_support(indices=False)
[source]
Get a mask, or integer index, of the features selected
Parameters: |
|
---|---|
Returns: |
|
inverse_transform(X)
[source]
Reverse the transformation operation
Parameters: |
|
---|---|
Returns: |
|
set_params(**params)
[source]
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter>
so that it’s possible to update each component of a nested object.
Returns: |
|
---|
transform(X)
[source]
Reduce X to the selected features.
Parameters: |
|
---|---|
Returns: |
|
© 2007–2018 The scikit-learn developers
Licensed under the 3-clause BSD License.
http://scikit-learn.org/stable/modules/generated/sklearn.feature_selection.VarianceThreshold.html