RFECV
Recursive feature elimination with cross-validation to select features.
See glossary entry for cross-validation estimator.
Read more in the User Guide.
Python Reference (opens in a new tab)
Constructors
constructor()
Signature
new RFECV(opts?: object): RFECV;
Parameters
Name | Type | Description |
---|---|---|
opts? | object | - |
opts.cv? | number | Determines the cross-validation splitting strategy. Possible inputs for cv are: |
opts.estimator? | any | A supervised learning estimator with a fit method that provides information about feature importance either through a coef\_ attribute or through a feature\_importances\_ attribute. |
opts.importance_getter? | string | If ‘auto’, uses the feature importance either through a coef\_ or feature\_importances\_ attributes of estimator. Also accepts a string that specifies an attribute name/path for extracting feature importance. For example, give regressor\_.coef\_ in case of TransformedTargetRegressor or named\_steps.clf.feature\_importances\_ in case of Pipeline with its last step named clf . If callable , overrides the default feature importance getter. The callable is passed with the fitted estimator and it should return importance for each feature. Default Value 'auto' |
opts.min_features_to_select? | number | The minimum number of features to be selected. This number of features will always be scored, even if the difference between the original feature count and min\_features\_to\_select isn’t divisible by step . Default Value 1 |
opts.n_jobs? | number | Number of cores to run in parallel while fitting across folds. undefined means 1 unless in a joblib.parallel\_backend (opens in a new tab) context. \-1 means using all processors. See Glossary for more details. |
opts.scoring? | string | A string (see model evaluation documentation) or a scorer callable object / function with signature scorer(estimator, X, y) . |
opts.step? | number | If greater than or equal to 1, then step corresponds to the (integer) number of features to remove at each iteration. If within (0.0, 1.0), then step corresponds to the percentage (rounded down) of features to remove at each iteration. Note that the last iteration may remove fewer than step features in order to reach min\_features\_to\_select . Default Value 1 |
opts.verbose? | number | Controls verbosity of output. Default Value 0 |
Returns
Defined in: generated/feature_selection/RFECV.ts:25 (opens in a new tab)
Properties
_isDisposed
boolean
=false
Defined in: generated/feature_selection/RFECV.ts:23 (opens in a new tab)
_isInitialized
boolean
=false
Defined in: generated/feature_selection/RFECV.ts:22 (opens in a new tab)
_py
PythonBridge
Defined in: generated/feature_selection/RFECV.ts:21 (opens in a new tab)
id
string
Defined in: generated/feature_selection/RFECV.ts:18 (opens in a new tab)
opts
any
Defined in: generated/feature_selection/RFECV.ts:19 (opens in a new tab)
Accessors
cv_results_
A dict with keys:
Signature
cv_results_(): Promise<any>;
Returns
Promise
<any
>
Defined in: generated/feature_selection/RFECV.ts:624 (opens in a new tab)
estimator_
The fitted estimator used to select features.
Signature
estimator_(): Promise<any>;
Returns
Promise
<any
>
Defined in: generated/feature_selection/RFECV.ts:601 (opens in a new tab)
feature_names_in_
Names of features seen during fit. Defined only when X
has feature names that are all strings.
Signature
feature_names_in_(): Promise<ArrayLike>;
Returns
Promise
<ArrayLike
>
Defined in: generated/feature_selection/RFECV.ts:693 (opens in a new tab)
n_features_
The number of selected features with cross-validation.
Signature
n_features_(): Promise<number>;
Returns
Promise
<number
>
Defined in: generated/feature_selection/RFECV.ts:647 (opens in a new tab)
n_features_in_
Number of features seen during fit. Only defined if the underlying estimator exposes such an attribute when fit.
Signature
n_features_in_(): Promise<number>;
Returns
Promise
<number
>
Defined in: generated/feature_selection/RFECV.ts:670 (opens in a new tab)
py
Signature
py(): PythonBridge;
Returns
PythonBridge
Defined in: generated/feature_selection/RFECV.ts:82 (opens in a new tab)
Signature
py(pythonBridge: PythonBridge): void;
Parameters
Name | Type |
---|---|
pythonBridge | PythonBridge |
Returns
void
Defined in: generated/feature_selection/RFECV.ts:86 (opens in a new tab)
ranking_
The feature ranking, such that ranking\_\[i\]
corresponds to the ranking position of the i-th feature. Selected (i.e., estimated best) features are assigned rank 1.
Signature
ranking_(): Promise<any[]>;
Returns
Promise
<any
[]>
Defined in: generated/feature_selection/RFECV.ts:718 (opens in a new tab)
support_
The mask of selected features.
Signature
support_(): Promise<ArrayLike>;
Returns
Promise
<ArrayLike
>
Defined in: generated/feature_selection/RFECV.ts:740 (opens in a new tab)
Methods
decision_function()
Compute the decision function of X
.
Signature
decision_function(opts: object): Promise<any>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.X? | any [] | The input samples. Internally, it will be converted to dtype=np.float32 and if a sparse matrix is provided to a sparse csr\_matrix . |
Returns
Promise
<any
>
Defined in: generated/feature_selection/RFECV.ts:157 (opens in a new tab)
dispose()
Disposes of the underlying Python resources.
Once dispose()
is called, the instance is no longer usable.
Signature
dispose(): Promise<void>;
Returns
Promise
<void
>
Defined in: generated/feature_selection/RFECV.ts:140 (opens in a new tab)
fit()
Fit the RFE model and automatically tune the number of selected features.
Signature
fit(opts: object): Promise<any>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.X? | ArrayLike | Training vector, where n\_samples is the number of samples and n\_features is the total number of features. |
opts.groups? | ArrayLike | Group labels for the samples used while splitting the dataset into train/test set. Only used in conjunction with a “Group” cv instance (e.g., GroupKFold ). |
opts.y? | ArrayLike | Target values (integers for classification, real numbers for regression). |
Returns
Promise
<any
>
Defined in: generated/feature_selection/RFECV.ts:190 (opens in a new tab)
fit_transform()
Fit to data, then transform it.
Fits transformer to X
and y
with optional parameters fit\_params
and returns a transformed version of X
.
Signature
fit_transform(opts: object): Promise<any[]>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.X? | ArrayLike [] | Input samples. |
opts.fit_params? | any | Additional fit parameters. |
opts.y? | ArrayLike | Target values (undefined for unsupervised transformations). |
Returns
Promise
<any
[]>
Defined in: generated/feature_selection/RFECV.ts:239 (opens in a new tab)
get_feature_names_out()
Mask feature names according to selected features.
Signature
get_feature_names_out(opts: object): Promise<any>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.input_features? | any | Input features. |
Returns
Promise
<any
>
Defined in: generated/feature_selection/RFECV.ts:286 (opens in a new tab)
get_support()
Get a mask, or integer index, of the features selected.
Signature
get_support(opts: object): Promise<any>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.indices? | boolean | If true , the return value will be an array of integers, rather than a boolean mask. Default Value false |
Returns
Promise
<any
>
Defined in: generated/feature_selection/RFECV.ts:319 (opens in a new tab)
init()
Initializes the underlying Python resources.
This instance is not usable until the Promise
returned by init()
resolves.
Signature
init(py: PythonBridge): Promise<void>;
Parameters
Name | Type |
---|---|
py | PythonBridge |
Returns
Promise
<void
>
Defined in: generated/feature_selection/RFECV.ts:95 (opens in a new tab)
inverse_transform()
Reverse the transformation operation.
Signature
inverse_transform(opts: object): Promise<any>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.X? | any | The input samples. |
Returns
Promise
<any
>
Defined in: generated/feature_selection/RFECV.ts:354 (opens in a new tab)
predict()
Reduce X to the selected features and predict using the estimator.
Signature
predict(opts: object): Promise<any>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.X? | any | The input samples. |
Returns
Promise
<any
>
Defined in: generated/feature_selection/RFECV.ts:387 (opens in a new tab)
predict_log_proba()
Predict class log-probabilities for X.
Signature
predict_log_proba(opts: object): Promise<any[]>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.X? | any | The input samples. |
Returns
Promise
<any
[]>
Defined in: generated/feature_selection/RFECV.ts:420 (opens in a new tab)
predict_proba()
Predict class probabilities for X.
Signature
predict_proba(opts: object): Promise<any[]>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.X? | any [] | The input samples. Internally, it will be converted to dtype=np.float32 and if a sparse matrix is provided to a sparse csr\_matrix . |
Returns
Promise
<any
[]>
Defined in: generated/feature_selection/RFECV.ts:453 (opens in a new tab)
score()
Reduce X to the selected features and return the score of the estimator.
Signature
score(opts: object): Promise<number>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.X? | any | The input samples. |
opts.fit_params? | any | Parameters to pass to the score method of the underlying estimator. |
opts.y? | any | The target values. |
Returns
Promise
<number
>
Defined in: generated/feature_selection/RFECV.ts:486 (opens in a new tab)
set_output()
Set output container.
See Introducing the set_output API for an example on how to use the API.
Signature
set_output(opts: object): Promise<any>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.transform? | "default" | "pandas" | Configure output of transform and fit\_transform . |
Returns
Promise
<any
>
Defined in: generated/feature_selection/RFECV.ts:535 (opens in a new tab)
transform()
Reduce X to the selected features.
Signature
transform(opts: object): Promise<any>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.X? | any | The input samples. |
Returns
Promise
<any
>
Defined in: generated/feature_selection/RFECV.ts:568 (opens in a new tab)