Class: VarianceThreshold
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.
Constructors
new VarianceThreshold()
new VarianceThreshold(
opts
?):VarianceThreshold
Parameters
Parameter | Type | Description |
---|---|---|
opts ? | object | - |
opts.threshold ? | number | 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. |
Returns VarianceThreshold
Defined in generated/feature_selection/VarianceThreshold.ts:25
Properties
Property | Type | Default value | Defined in |
---|---|---|---|
_isDisposed | boolean | false | generated/feature_selection/VarianceThreshold.ts:23 |
_isInitialized | boolean | false | generated/feature_selection/VarianceThreshold.ts:22 |
_py | PythonBridge | undefined | generated/feature_selection/VarianceThreshold.ts:21 |
id | string | undefined | generated/feature_selection/VarianceThreshold.ts:18 |
opts | any | undefined | generated/feature_selection/VarianceThreshold.ts:19 |
Accessors
feature_names_in_
Get Signature
get feature_names_in_():
Promise
<ArrayLike
>
Names of features seen during fit. Defined only when X
has feature names that are all strings.
Returns Promise
<ArrayLike
>
Defined in generated/feature_selection/VarianceThreshold.ts:465
n_features_in_
Get Signature
get n_features_in_():
Promise
<number
>
Number of features seen during fit.
Returns Promise
<number
>
Defined in generated/feature_selection/VarianceThreshold.ts:438
py
Get Signature
get py():
PythonBridge
Returns PythonBridge
Set Signature
set py(
pythonBridge
):void
Parameters
Parameter | Type |
---|---|
pythonBridge | PythonBridge |
Returns void
Defined in generated/feature_selection/VarianceThreshold.ts:37
variances_
Get Signature
get variances_():
Promise
<any
>
Variances of individual features.
Returns Promise
<any
>
Defined in generated/feature_selection/VarianceThreshold.ts:411
Methods
dispose()
dispose():
Promise
<void
>
Disposes of the underlying Python resources.
Once dispose()
is called, the instance is no longer usable.
Returns Promise
<void
>
Defined in generated/feature_selection/VarianceThreshold.ts:91
fit()
fit(
opts
):Promise
<any
>
Learn empirical variances from X.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.X ? | any | Data from which to compute variances, where n_samples is the number of samples and n_features is the number of features. |
opts.y ? | any | Ignored. This parameter exists only for compatibility with sklearn.pipeline.Pipeline. |
Returns Promise
<any
>
Defined in generated/feature_selection/VarianceThreshold.ts:108
fit_transform()
fit_transform(
opts
):Promise
<any
[]>
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
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.fit_params ? | any | Additional fit parameters. |
opts.X ? | ArrayLike [] | Input samples. |
opts.y ? | ArrayLike | Target values (undefined for unsupervised transformations). |
Returns Promise
<any
[]>
Defined in generated/feature_selection/VarianceThreshold.ts:149
get_feature_names_out()
get_feature_names_out(
opts
):Promise
<any
>
Mask feature names according to selected features.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.input_features ? | any | Input features. |
Returns Promise
<any
>
Defined in generated/feature_selection/VarianceThreshold.ts:195
get_metadata_routing()
get_metadata_routing(
opts
):Promise
<any
>
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.routing ? | any | A MetadataRequest encapsulating routing information. |
Returns Promise
<any
>
Defined in generated/feature_selection/VarianceThreshold.ts:233
get_support()
get_support(
opts
):Promise
<any
>
Get a mask, or integer index, of the features selected.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.indices ? | boolean | If true , the return value will be an array of integers, rather than a boolean mask. |
Returns Promise
<any
>
Defined in generated/feature_selection/VarianceThreshold.ts:269
init()
init(
py
):Promise
<void
>
Initializes the underlying Python resources.
This instance is not usable until the Promise
returned by init()
resolves.
Parameters
Parameter | Type |
---|---|
py | PythonBridge |
Returns Promise
<void
>
Defined in generated/feature_selection/VarianceThreshold.ts:50
inverse_transform()
inverse_transform(
opts
):Promise
<any
>
Reverse the transformation operation.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.X ? | any | The input samples. |
Returns Promise
<any
>
Defined in generated/feature_selection/VarianceThreshold.ts:305
set_output()
set_output(
opts
):Promise
<any
>
Set output container.
See Introducing the set_output API for an example on how to use the API.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.transform ? | "default" | "pandas" | "polars" | Configure output of transform and fit_transform . |
Returns Promise
<any
>
Defined in generated/feature_selection/VarianceThreshold.ts:343
transform()
transform(
opts
):Promise
<any
>
Reduce X to the selected features.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.X ? | any | The input samples. |
Returns Promise
<any
>
Defined in generated/feature_selection/VarianceThreshold.ts:377