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

d should be allowed to equal p. #16

Open
nspyrison opened this issue Mar 20, 2023 · 2 comments
Open

d should be allowed to equal p. #16

nspyrison opened this issue Mar 20, 2023 · 2 comments

Comments

@nspyrison
Copy link

do.pca() still doesn't allow d to be equal to p which is fully valid. It currently silently drops a dimension.

dat <- mtcars[, 1:2]
Rdimtools::do.pca(X = as.matrix(dat), ndim = 2)
#> $Y
#>             [,1]
#>  [1,] -18.831637
#>  [2,] -18.831637
#>  [3,] -21.074684
#>  [4,] -19.218921
#>  [5,] -16.104483
#>  [6,] -16.023824
#>  [7,] -11.844353
#>  [8,] -22.623822
#>  [9,] -21.074684
#> [10,] -17.088856
#> [11,] -15.733360
#> [12,] -13.877597
#> [13,] -14.748987
#> [14,] -12.715744
#> [15,]  -8.068329
#> [16,]  -8.068329
#> [17,] -12.231638
#> [18,] -30.369513
#> [19,] -28.433090
#> [20,] -31.821830
#> [21,] -19.816009
#> [22,] -13.006207
#> [23,] -12.715744
#> [24,] -10.876142
#> [25,] -16.588589
#> [26,] -25.431635
#> [27,] -24.172960
#> [28,] -28.433090
#> [29,] -13.296670
#> [30,] -17.572962
#> [31,] -12.522101
#> [32,] -19.719188
#> 
#> $vars
#> [1] 38.69375
#> 
#> $projection
#>            [,1]
#> [1,] -0.9682113
#> [2,]  0.2501336
#> 
#> $algorithm
#> [1] "linear:PCA"
#> 
#> attr(,"class")
#> [1] "Rdimtools"

Created on 2023-03-20 with reprex v2.0.2

@kisungyou
Copy link
Owner

@nspyrison I agree that this ninja operation can be an issue. I'm currently working on rewriting of the package whenever available (job market is just over) and will probably put a warning/message popping up for the user. However, d=p is just rotation by PCs and I am wondering whether it would be worth to allow this operation. I would appreciate your opinion as I want to be as much consistent as possible across all functionalities offered in this package.

@nspyrison
Copy link
Author

Hi @kisungyou, thank you for your development work. Rotations are a valid and important aspect of exploring dimensions. IMHO d=p absolutely should be facilitated wherever possible.

I love the idea of your package, but I have had to roll back to prcomp and MASS::lda on more than one occasion because Rdimtools was developed with dim reduction in mind. The more general and extensible you make you can make the Rdimtools allow others to use and build on top of it, rather than being forced to seek the original implementations.

HTH

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants