PrincipalComponentAnalysis.GetQResiduals Method

Returns the Q-residuals, also known as squared prediction errors (SPE), for observations.

Definition

Namespace: Numerics.NET.Statistics.Multivariate
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 10.8.0
C#
public Vector<double> GetQResiduals(
	Matrix<double> observations
)

Parameters

observations  Matrix<Double>
A matrix with one observation per row and the same feature order as the training data.

Return Value

Vector<Double>
A vector containing one Q-residual per row, with the observation matrix's row index.

Remarks

The fitted matrix preprocessing is applied to the observations. Each result is the squared Euclidean norm of the difference between a preprocessed row and its reconstruction using the currently retained NumberOfComponents principal components. The calculation is performed in PCA preprocessing space, so it generally differs from squared reconstruction error in the original measurement units when scaling is enabled.

This method is also available on deployed and deserialized models.

Exceptions

ArgumentNullExceptionobservations is null.
DimensionMismatchExceptionThe column count does not match the model's feature count.
InvalidOperationExceptionThe model has not been fitted. Call Fit() first.

See Also