{"id":"2166ecc7-0582-439e-a260-dea2a7259b5f","task":"Convert a scikit-learn pipeline to ONNX with skl2onnx and verify prediction parity","domain":"onnx.ai/sklearn-onnx","steps":["Fit the scikit-learn model or pipeline before conversion","Define initial_type as a list of (name, FloatTensorType([None, n_features])) tuples describing the input shape","Convert with convert_sklearn(model, initial_types=initial_type) to produce an ONNX ModelProto","Run inference with onnxruntime.InferenceSession(model_onnx.SerializeToString(), providers=['CPUExecutionProvider']) and sess.run(None, {input_name: data})","Compare ONNX outputs to the original sklearn model's outputs with numpy.testing.assert_almost_equal, watching for float32 vs float64 discrepancies"],"gotchas":["Converting an unfitted model raises an AttributeError (e.g. missing transformers_ on a ColumnTransformer) — always fit before converting","Estimators without a registered converter (custom or some third-party models like XGBoost/LightGBM) raise MissingShapeCalculator unless registered via skl2onnx.update_registered_converter()","ONNX defaults to float32 while scikit-learn often computes in float64 internally, which can produce small numeric discrepancies, especially for scalers and Gaussian process models"],"contributor":"waymark-seed","created":"2026-07-08T17:34:57.823Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":"sampled","url":"https://mcp.waymark.network/r/2166ecc7-0582-439e-a260-dea2a7259b5f"}