Select features according to the k highest scores.
Read more in the User Guide.
new SelectKBest(opts?: object): SelectKBest;
Name | Type | Description |
---|---|---|
opts? |
object |
- |
opts.k? |
number | "all" |
Number of top features to select. The “all” option bypasses selection, for use in a parameter search. Default Value 10 |
opts.score_func? |
any |
Function taking two arrays X and y, and returning a pair of arrays (scores, pvalues) or a single array with scores. Default is f_classif (see below “See Also”). The default function only works with classification tasks. |
Defined in: generated/feature_selection/SelectKBest.ts:23
Disposes of the underlying Python resources.
Once dispose()
is called, the instance is no longer usable.
dispose(): Promise<void>;
Promise
<void
>
Defined in: generated/feature_selection/SelectKBest.ts:93
Run score function on (X, y) and get the appropriate features.
fit(opts: object): Promise<any>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.X? |
ArrayLike [] |
The training input samples. |
opts.y? |
ArrayLike |
The target values (class labels in classification, real numbers in regression). |
Promise
<any
>
Defined in: generated/feature_selection/SelectKBest.ts:110
Fit to data, then transform it.
Fits transformer to X
and y
with optional parameters fit\_params
and returns a transformed version of X
.
fit_transform(opts: object): Promise<any[]>;
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). |
Promise
<any
[]>
Defined in: generated/feature_selection/SelectKBest.ts:152
Mask feature names according to selected features.
get_feature_names_out(opts: object): Promise<any>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.input_features? |
any |
Input features. |
Promise
<any
>
Defined in: generated/feature_selection/SelectKBest.ts:199
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
get_metadata_routing(opts: object): Promise<any>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.routing? |
any |
A MetadataRequest encapsulating routing information. |
Promise
<any
>
Defined in: generated/feature_selection/SelectKBest.ts:237
Get a mask, or integer index, of the features selected.
get_support(opts: object): Promise<any>;
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 |
Promise
<any
>
Defined in: generated/feature_selection/SelectKBest.ts:272
Initializes the underlying Python resources.
This instance is not usable until the Promise
returned by init()
resolves.
init(py: PythonBridge): Promise<void>;
Name | Type |
---|---|
py |
PythonBridge |
Promise
<void
>
Defined in: generated/feature_selection/SelectKBest.ts:53
Reverse the transformation operation.
inverse_transform(opts: object): Promise<any>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.X? |
any |
The input samples. |
Promise
<any
>
Defined in: generated/feature_selection/SelectKBest.ts:307
Set output container.
See Introducing the set_output API for an example on how to use the API.
set_output(opts: object): Promise<any>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.transform? |
"default" | "pandas" |
Configure output of transform and fit\_transform . |
Promise
<any
>
Defined in: generated/feature_selection/SelectKBest.ts:342
Reduce X to the selected features.
transform(opts: object): Promise<any>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.X? |
any |
The input samples. |
Promise
<any
>
Defined in: generated/feature_selection/SelectKBest.ts:375
boolean
=false
Defined in: generated/feature_selection/SelectKBest.ts:21
boolean
=false
Defined in: generated/feature_selection/SelectKBest.ts:20
PythonBridge
Defined in: generated/feature_selection/SelectKBest.ts:19
string
Defined in: generated/feature_selection/SelectKBest.ts:16
any
Defined in: generated/feature_selection/SelectKBest.ts:17
Names of features seen during fit. Defined only when X
has feature names that are all strings.
feature_names_in_(): Promise<ArrayLike>;
Promise
<ArrayLike
>
Defined in: generated/feature_selection/SelectKBest.ts:479
Number of features seen during fit.
n_features_in_(): Promise<number>;
Promise
<number
>
Defined in: generated/feature_selection/SelectKBest.ts:454
p-values of feature scores, undefined
if score\_func
returned only scores.
pvalues_(): Promise<ArrayLike>;
Promise
<ArrayLike
>
Defined in: generated/feature_selection/SelectKBest.ts:431
py(): PythonBridge;
PythonBridge
Defined in: generated/feature_selection/SelectKBest.ts:40
py(pythonBridge: PythonBridge): void;
Name | Type |
---|---|
pythonBridge |
PythonBridge |
void
Defined in: generated/feature_selection/SelectKBest.ts:44
Scores of features.
scores_(): Promise<ArrayLike>;
Promise
<ArrayLike
>
Defined in: generated/feature_selection/SelectKBest.ts:408