yobx.sklearn.feature_selection.select_from_model#

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

Converts a sklearn.feature_selection.SelectFromModel into ONNX.

After fitting, the meta-transformer selects features whose importance (as reported by the wrapped estimator’s feature_importances_ or coef_ attribute) exceeds the configured threshold. The selected column indices are fixed at conversion time via estimator.get_support(indices=True), 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 SelectFromModel

  • outputs – desired output names

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

  • name – prefix name for the added nodes

Returns:

output name