yobx.sklearn.kernel_approximation.nystroem#
- yobx.sklearn.kernel_approximation.nystroem.sklearn_nystroem(g: GraphBuilderExtendedProtocol, sts: Dict, outputs: List[str], estimator: Nystroem, X: str, name: str = 'nystroem') str[source]#
Converts a
sklearn.kernel_approximation.Nystroeminto ONNX.The out-of-sample transform replicates
sklearn.kernel_approximation.Nystroem.transform():Compute the pairwise kernel matrix between X (shape
(N, F)) and the stored componentscomponents_(shape(C, F)):linear —
K = X @ components_.Trbf —
K[i,j] = exp(-gamma * ||X[i] - components_[j]||^2)poly —
K = (gamma * X @ components_.T + coef0) ^ degreesigmoid —
K = tanh(gamma * X @ components_.T + coef0)cosine —
K[i,j] = (X[i]/||X[i]||) * (components_[j]/||components_[j]||)
Callable and
precomputedkernels are not supported.Project using the normalization matrix stored in
normalization_:result = K @ normalization_.T # (N, C)
- Parameters:
g – the graph builder to add nodes to
sts – shapes defined by scikit-learn
estimator – a fitted
Nystroemoutputs – desired output names (transformed inputs)
X – input tensor name
name – prefix name for the added nodes
- Returns:
output tensor name
- Raises:
NotImplementedError – for callable kernels,
kernel='precomputed', or unsupported kernel names