lale.lib.sklearn.select_k_best module

class lale.lib.sklearn.select_k_best.SelectKBest(*, score_func='<function f_classif>', k=10)

Bases: PlannedIndividualOp

Select k best feature selection transformer from scikit-learn.

This documentation is auto-generated from JSON schemas.

Parameters
  • score_func (callable, not for optimizer, default <function f_classif at 0x7fdfbf5e3160>) – Function taking two arrays X and y, and returning a pair of arrays (scores, pvalues) or a single array with scores.

  • k (union type, default 10) –

    Number of top features to select

    • integer, >=1, >=2 for optimizer, <=’X/items/maxItems’, <=15 for optimizer

    • or ‘all’

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

Train the operator.

Note: The fit method is not available until this operator is trainable.

Once this method is available, it will have the following signature:

Parameters
  • X (array of items : array of items : float) – Training input samples.

  • y (union type) –

    Target values (class labels in classification, real numbers in regression).

    • array of items : float

    • or array of items : string

    • or array of items : boolean

transform(X, y=None)

Transform the data.

Note: The transform method is not available until this operator is trained.

Once this method is available, it will have the following signature:

Parameters

X (array of items : array of items : float) – The input samples

Returns

result – The input samples with only the selected features.

Return type

array of items : array of items : float