decomp() fits a decomposition with a configuration from one of the setup_*() functions listed by available_decomposition(). apply_decomp() transforms new cases with a fitted decomposition, and reconstruct() maps components back to the feature space where the method allows it. This chapter decomposes the 16 voice measures of the Parkinson’s data and the 9 numeric features of the diabetes data, and uses a decomposition inside supervised training.
The 16 voice measures fall into groups that measure related properties of the voice: five jitter measures, six shimmer measures, two noise ratios, and three nonlinear measures. Their correlations:
Importance of first k=5 (out of 16) components:
PC1 PC2 PC3 PC4 PC5
Standard deviation 3.356 1.293 1.1138 0.8746 0.5561
Proportion of Variance 0.704 0.105 0.0775 0.0478 0.0193
Cumulative Proportion 0.704 0.808 0.8859 0.9337 0.9530
The first component explains 70.4% of the variance of the 16 measures, and the first three together 88.6%. The loadings show which measures define each component:
The first component weighs the jitter and shimmer measures and both noise ratios with loadings of similar magnitude, the harmonics-to-noise ratio with the opposite sign, since a higher value of it indicates a more regular voice: the component is a general measure of voice irregularity. The second component contrasts the jitter measures with the shimmer measures. The fitted scores are in the transformed property. Plotting the first two components for the recordings of six patients shows the structure of the repeated measurements:
The recordings of different patients overlap, and each patient’s recordings are spread over a region of their own size and position. Across all 42 patients, the variance of the patient means accounts for 51.1% of the variance of the first component and 37.0% of the second: a substantial part of the variation in the voice measures is between patients, the structure that made grouped resampling necessary (Section 11.6).
47.2 Applying a decomposition to new cases
apply_decomp() projects new cases with the fitted centers, scales and loadings. Projecting the first three recordings reproduces their fitted scores:
t-SNE and UMAP embeddings of the 9 numeric diabetes features, with each patient labeled by the tertile of disease progression, which the decompositions do not use:
Neither embedding shows separated groups. The tertiles of progression form a gradient across both embeddings, with substantial overlap, consistent with an \(R^2\) near 0.5 for the supervised models of earlier chapters. The positions of points in these plots depend on the random initialization, the perplexity and the number of neighbors.
47.4 A decomposition inside training
train() accepts a decomposition_config, which is fitted within each training set and applied to the corresponding test set (Section 46.6). A linear model of diabetes progression on the first \(k\) principal components of the 9 numeric features, with sex as an additional feature, for several values of \(k\):
With all 9 components, the model is a reparameterization of the linear model on the original features, and its \(R^2\), 0.493, is that of the linear model. Fewer components discard directions of small variance in the features, and with them some of the information that predicts progression.