yobx.sklearn.gaussian_process.gp#
- yobx.sklearn.gaussian_process.gp.sklearn_gaussian_process_classifier(g: GraphBuilderExtendedProtocol, sts: Dict, outputs: List[str], estimator: GaussianProcessClassifier, X: str, name: str = 'gpc') Tuple[str, str][source]#
Converts a
sklearn.gaussian_process.GaussianProcessClassifierinto ONNX.Binary classification (two classes):
K_trans = kernel(X, X_train) # (N, M) f_mean = K_trans @ (y_train - π) # (N,) posterior mean v = M_pre @ K_trans.T # (M, N) M_pre precomputed f_var = diag(K(X,X)) - Σ_col(v²) # (N,) posterior variance π* ≈ Williams-Barber 5-point approximation # (N,) proba = [[1-π*, π*]] # (N, 2)
where
M_pre = L⁻¹ · diag(W_sr)is precomputed once at conversion time.Multiclass (
multi_class="one_vs_rest"):Each binary sub-estimator produces
π*ₖ; these are stacked and row-normalised:Y[:, k] = π*ₖ for k in 0…C-1 proba = Y / row_sum(Y)
Supported kernels — see
_emit_kernel_matrix()for the full list.- Parameters:
g – the graph builder to add nodes to
sts – shapes defined by scikit-learn
outputs – desired output names (label, probabilities)
estimator – a fitted
GaussianProcessClassifierX – input tensor name
name – prefix for added node names
- Returns:
tuple
(label_result_name, proba_result_name)- Raises:
NotImplementedError – for
multi_class="one_vs_one"with >2 classes
- yobx.sklearn.gaussian_process.gp.sklearn_gaussian_process_regressor(g: GraphBuilderExtendedProtocol, sts: Dict, outputs: List[str], estimator: GaussianProcessRegressor, X: str, name: str = 'gpr') str | Tuple[str, ...][source]#
Converts a
sklearn.gaussian_process.GaussianProcessRegressorinto ONNX (mean prediction only).The predictive mean follows Algorithm 2.1 of Gaussian Processes for Machine Learning (Rasmussen & Williams 2006, p. 19):
K_trans = kernel(X, X_train) # (N, M) y_mean = K_trans @ α + y_train_mean # (N,) or (N, n_targets)
where
α(estimator.alpha_) and the denormalisation offsets (_y_train_mean,_y_train_std) are stored as ONNX constants.Supported kernels — see
_emit_kernel_matrix()for the full list.- Parameters:
g – the graph builder to add nodes to
sts – shapes defined by scikit-learn
outputs – desired output names
estimator – a fitted
GaussianProcessRegressorX – input tensor name
name – prefix for added node names
- Returns:
output tensor name (predictions)