yobx.sklearn.kernel_approximation.rbf_sampler#
- yobx.sklearn.kernel_approximation.rbf_sampler.sklearn_rbf_sampler(g: GraphBuilderExtendedProtocol, sts: Dict, outputs: List[str], estimator: RBFSampler, X: str, name: str = 'rbf_sampler') str[source]#
Converts a
sklearn.kernel_approximation.RBFSamplerinto ONNX.The transform replicates
sklearn.kernel_approximation.RBFSampler.transform()using random Fourier features (Random Kitchen Sinks) to approximate the RBF (Gaussian) kernel:X_new = sqrt(2 / n_components) * cos(X @ random_weights_ + random_offset_)
where
random_weights_has shape(n_features, n_components)andrandom_offset_has shape(n_components,).Graph structure:
X ──MatMul(random_weights_)──Add(random_offset_)──Cos──Mul(scale)──► X_new
- Parameters:
g – the graph builder to add nodes to
sts – shapes defined by scikit-learn
estimator – a fitted
RBFSampleroutputs – desired output names (transformed inputs)
X – input tensor name (shape
(N, F))name – prefix name for the added nodes
- Returns:
output tensor name (shape
(N, n_components))