homlr icon indicating copy to clipboard operation
homlr copied to clipboard

Principal Component Analysis code error

Open vishnugunneri opened this issue 2 years ago • 1 comments

The following code:isn't running-

How many PCs required to explain at least 75% of total variability

min(which(ve$CVE >= 0.75))

[1] 27

Might be an issue with variable 've' because there is none Hands on ML error

vishnugunneri avatar Apr 27 '22 16:04 vishnugunneri

Good catch @vishnugunneri , there is a hidden code chunk that computes ve via:

ve <- data.frame(
  PC  = my_pca@model$importance %>% names(),
  PVE = my_pca@model$importance %>% .[2,] %>% unlist(),
  CVE = my_pca@model$importance %>% .[3,] %>% unlist()
)

bradleyboehmke avatar Apr 27 '22 17:04 bradleyboehmke