yobx.sklearn.impute.simple_imputer#
- yobx.sklearn.impute.simple_imputer.sklearn_simple_imputer(g: GraphBuilderExtendedProtocol, sts: Dict, outputs: List[str], estimator: SimpleImputer, X: str, name: str = 'simple_imputer') str[source]#
Converts a
sklearn.impute.SimpleImputerinto ONNX.All four strategies (
mean,median,most_frequent,constant) store the per-feature fill value inestimator.statistics_after fitting, so the ONNX graph only needs to detect missing entries and replace them with those constants.Graph structure when
missing_valuesisnumpy.nan(the default):X ──IsNaN──► nan_mask [N, F] │ statistics_ ──────┼──► Where ──► output │ X ─────────────────┘When
missing_valuesis a numeric value theIsNaNnode is replaced by anEqualnode:X ──Equal(missing_values)──► mask [N, F] │ statistics_ ─────────────────────┼──► Where ──► output │ X ─────────────────────────────────┘add_indicator=Trueis not supported and raisesNotImplementedError.- Parameters:
g – the graph builder to add nodes to
sts – shapes defined by scikit-learn
estimator – a fitted
SimpleImputeroutputs – desired output names
X – input name
name – prefix name for the added nodes
- Returns:
output name