yobx.sklearn.neighbors.neighborhood_components_analysis#

yobx.sklearn.neighbors.neighborhood_components_analysis.sklearn_neighborhood_components_analysis(g: GraphBuilderExtendedProtocol, sts: Dict, outputs: List[str], estimator: NeighborhoodComponentsAnalysis, X: str, name: str = 'nca') str[source]#

Converts a sklearn.neighbors.NeighborhoodComponentsAnalysis into ONNX.

The transformation is a linear projection of the input onto the learned components (no centering is applied):

X  ──MatMul(components_.T)──►  output

The learned components_ matrix has shape (n_components, n_features). At inference time this produces an output of shape (N, n_components).

Parameters:
  • g – the graph builder to add nodes to

  • sts – shapes defined by scikit-learn

  • outputs – desired output names (projected inputs)

  • estimator – a fitted NeighborhoodComponentsAnalysis

  • X – input tensor name

  • name – prefix name for the added nodes

Returns:

output tensor name