Class Pca

java.lang.Object
ai.beestream.jitnn.ml.Pca

public final class Pca extends Object
Principal component analysis from the eigendecomposition of the covariance matrix, after scikit-learn's PCA: components as rows, ordered by explained variance, each signed so that its largest-magnitude entry is positive (scikit-learn's svd_flip convention).
  • Constructor Details

    • Pca

      public Pca(int components)
      PCA keeping components components.
  • Method Details

    • fit

      public Pca fit(Tensor x)
      Fits samples x [n, features].
    • components

      public Tensor components()
      The components [k, d].
    • explainedVariance

      public float[] explainedVariance()
      The variance explained by each component.
    • explainedVarianceRatio

      public float[] explainedVarianceRatio()
      The fraction of the total variance explained by each component.
    • transform

      public Tensor transform(Tensor x)
      Projection [n, k] of x onto the components.
    • inverseTransform

      public Tensor inverseTransform(Tensor z)
      Back from the projection to the feature space.