yobx.sklearn.decomposition.truncated_svd#

yobx.sklearn.decomposition.truncated_svd.sklearn_truncated_svd(g: GraphBuilderExtendedProtocol, sts: Dict, outputs: List[str], estimator: TruncatedSVD, X: str, name: str = 'truncated_svd') str[source]#

Converts a sklearn.decomposition.TruncatedSVD into ONNX.

Unlike PCA, TruncatedSVD does not center the data before projecting. The transformation is simply a matrix multiplication:

X  ──MatMul(components_.T)──►  output
Parameters:
  • g – the graph builder to add nodes to

  • sts – shapes defined by scikit-learn

  • estimator – a fitted TruncatedSVD

  • outputs – desired output names (projected inputs)

  • X – input tensor name

  • name – prefix name for the added nodes

Returns:

output tensor name