yobx.sklearn.feature_selection.select_k_best#

yobx.sklearn.feature_selection.select_k_best.sklearn_select_k_best(g: GraphBuilderExtendedProtocol, sts: Dict, outputs: List[str], estimator: SelectKBest, X: str, name: str = 'select_k_best') str[source]#

Converts a sklearn.feature_selection.SelectKBest into ONNX.

After fitting, the transformer keeps the k features with the highest scores according to the chosen scoring function. The selected column indices are stored in estimator.get_support(indices=True) and are fixed constants at conversion time, so the ONNX graph contains a single Gather node that selects those columns from the input matrix:

X  ──Gather(axis=1, indices)──►  output
Parameters:
  • g – the graph builder to add nodes to

  • sts – shapes defined by scikit-learn

  • estimator – a fitted SelectKBest

  • outputs – desired output names

  • X – input name (shape (N, F))

  • name – prefix name for the added nodes

Returns:

output name