pydiodon.quality¶
- pydiodon.quality(Y)[source]¶
computes the quality of projection per item and pr axis
- Parameters:
- Ya 2D \(n \\times p\) numpy array
a matrix of principal components
- Returns:
- Qual_axis2D numpy array
Qual_axis[i,j]: quality of the projection of item i on axis j
- Qual_cum2D numpy array
the rowise cumulated quality per axis up to j in column j.
Notes
The quality of the projection of the dataset on a subspace spanned by principal axis is a scalar giving a global estimate of the quality. However, the quality of projection may differ from item to item: some can be well projected on plane (1,2) and some other not. This function computes and plots the quality of projection of each item on subspace \(E_r\) spanned by r first axis.
More precisely, for each row i of the matrix of components Y
it computes:
the norm of each item: \(norm[i] = \sum_j Y[i,j]^2\)
Qual_axis: the quality of projection per axis: \(Qual\_axis[i,j] = Y[i,j]^2 / norm[i]\)
Qual_cum : the cumulated quality of projection up to axis j: \(Qual\_cum[i,j] = \sum_{k \leq j} Qual\_axis[i,k]\)
Example
>>> import pydiodon as dio >>> A, rn, cn = dio.load_dataset("diatoms_sweden") >>> Y, L, V = dio.pca(A) >>> Qual_axis, Qual_cum = dio.quality(Y)
af, revised 22.10.28, 23.01.18, 25.02.20