public class PPCA extends java.lang.Object implements LinearProjection, java.io.Serializable
y ∼ W * x + μ + εwhere latent variables x ∼ N(0, I), error (or noise) ε ∼ N(0, Ψ), and μ is the location term (mean). In probabilistic PCA, an isotropic noise model is used, i.e., noise variances constrained to be equal (Ψi = σ2). A close form of estimation of above parameters can be obtained by maximum likelihood method.
PCA
,
Serialized FormConstructor and Description |
---|
PPCA(double noise,
double[] mu,
smile.math.matrix.DenseMatrix loading,
smile.math.matrix.DenseMatrix projection)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static PPCA |
fit(double[][] data,
int k)
Fits probabilistic principal component analysis.
|
double[] |
getCenter()
Returns the center of data.
|
smile.math.matrix.DenseMatrix |
getLoadings()
Returns the variable loading matrix, ordered from largest to smallest
by corresponding eigenvalues.
|
double |
getNoiseVariance()
Returns the variance of noise.
|
smile.math.matrix.DenseMatrix |
getProjection()
Returns the projection matrix.
|
double[] |
project(double[] x)
Project a data point to the feature space.
|
double[][] |
project(double[][] x)
Project a set of data to the feature space.
|
public PPCA(double noise, double[] mu, smile.math.matrix.DenseMatrix loading, smile.math.matrix.DenseMatrix projection)
noise
- the variance of noise.mu
- the mean of samples.loading
- the loading matrix.projection
- the projection matrix.public smile.math.matrix.DenseMatrix getLoadings()
public double[] getCenter()
public double getNoiseVariance()
public smile.math.matrix.DenseMatrix getProjection()
getProjection
in interface LinearProjection
public double[] project(double[] x)
Projection
project
in interface LinearProjection
project
in interface Projection<double[]>
public double[][] project(double[][] x)
Projection
project
in interface LinearProjection
project
in interface Projection<double[]>
public static PPCA fit(double[][] data, int k)
data
- training data of which each row is a sample.k
- the number of principal component to learn.