yobx.sklearn.decomposition.pls_regression#
- yobx.sklearn.decomposition.pls_regression.sklearn_pls_regression(g: GraphBuilderExtendedProtocol, sts: Dict, outputs: List[str], estimator: PLSRegression, X: str, name: str = 'pls_regression') str[source]#
Converts a
sklearn.cross_decomposition.PLSRegressioninto ONNX.The prediction formula mirrors
PLSRegression.predict():X ──Sub(_x_mean)──► centered ──Gemm(coef_.T, intercept_)──► y_pred │ (if _predict_1d) Squeeze──► output │ (if not _predict_1d) └──────► outputThe input is centred by subtracting
_x_mean, then the prediction is computed asy_pred = centered @ coef_.T + intercept_. For single-target models (_predict_1disTrue) the output is squeezed to shape(N,); for multi-target models the output shape is(N, n_targets).- Parameters:
g – the graph builder to add nodes to
sts – shapes defined by scikit-learn
estimator – a fitted
PLSRegressionoutputs – desired output names (predictions)
X – input tensor name
name – prefix name for the added nodes
- Returns:
output tensor name
Note
discrepancies
The conversion shows discrepancies for
scikit-learn==1.4at least in unit tests. It is safe to assume it only works forscikit-learn>=1.8.