Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All types of tune go wrong in PCA model #484

Closed
bbayukari opened this issue Feb 9, 2023 · 3 comments
Closed

All types of tune go wrong in PCA model #484

bbayukari opened this issue Feb 9, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@bbayukari
Copy link
Collaborator

Describe the bug

All types of tune go wrong in PCA model, include "gic", "aic", "bic", "ebic" and "cv". Specifically, all information metric methods return 0; the result of "cv" method monotonically decreases as support_size increases so it's useless for selecting support_size.

Code for Reproduction

n <- 10000
p <- 5
support_size <- 3
dataset <- generate.spc.matrix(n, p, support_size, snr = 100, seed = 1)

for(ic_type in c("gic", "aic", "bic", "ebic")){
  spca_fit <- abesspca(dataset[["x"]], tune.type = ic_type)
  if(all(spca_fit[["tune.value"]] == 0)){
    print(sprintf("tune.value of %s is all zero!", ic_type))
  } 
}

spca_fit2 <- abesspca(dataset[["x"]], tune.type = "cv")
if(!is.unsorted(-spca_fit2[["tune.value"]])){
  print("tune.value of cv is sorted!")
}

Results:

[1] "tune.value of gic is all zero!"
[1] "tune.value of aic is all zero!"
[1] "tune.value of bic is all zero!"
[1] "tune.value of ebic is all zero!"
[1] "tune.value of cv is sorted!"

Desktop (please complete the following information):

  • OS: x86_64-w64-mingw32
  • R version 4.2.1
  • Package Version 0.4.6
@Mamba413
Copy link
Collaborator

I think this bug is relate to a recent pull request.#477 (comment)

@oooo26
Copy link
Collaborator

oooo26 commented Feb 10, 2023

Yep, there is a change here:

  • Kfolds should be 1 to enable IC;
  • ic_type should be 0 to use test loss in CV.

However, CV may not be a good strategy in PCA. (As you found, it will return the largest sparsity)

@Mamba413 Mamba413 added bug Something isn't working enhancement New feature or request labels Feb 13, 2023
@Mamba413
Copy link
Collaborator

I believe this issue has been addressed. So I will remove the bug label.

@Mamba413 Mamba413 removed the bug Something isn't working label Feb 20, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in cross validation:more criteria Feb 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

3 participants