kisungyou / Rdimtools

Dimension Reduction and Estimation Methods
https://kisungyou.com/Rdimtools
Other
52 stars 10 forks source link

do.olpp is not returning an orthogonal basis. #10

Open nspyrison opened 3 years ago

nspyrison commented 3 years ago
library(Rdimtools)
#> ** ------------------------------------------------------- **
#> ** Rdimtools
#> **  - Dimension Reduction and Estimation Toolbox
#> **
#> ** Version    : 1.0.8       (2021)
#> ** Maintainer : Kisung You  (kisungyou@outlook.com)
#> ** Website    : https://kisungyou.com/Rdimtools/
#> **
#> ** Please share any bugs or suggestions to the maintainer.
#> ** ------------------------------------------------------- **
#?Rdimtools::do.olpp

## use iris data
data(iris)
set.seed(100)
subid = sample(1:150, 50)
X     = as.matrix(iris[subid,1:4])
label = as.factor(iris[subid,5])

##  connecting 10% and 25% of data for graph construction each.
output1 <- do.olpp(X,ndim=2,type=c("proportion",0.10))
output2 <- do.olpp(X,ndim=2,type=c("proportion",0.25))

## Is basis orthogonal?
bas1 <- output1$projection
bas2 <- output2$projection
t(bas1) %*% bas1
#>           [,1]      [,2]
#> [1,] 1.0000000 0.9667698
#> [2,] 0.9667698 1.0000000
t(bas2) %*% bas2
#>          [,1]     [,2]
#> [1,] 1.000000 0.937701
#> [2,] 0.937701 1.000000
print("both are normal, but neither is orthogonal.")
#> [1] "both are normal, but neither is orthogonal."

Created on 2021-06-28 by the reprex package (v2.0.0)

kisungyou commented 3 years ago

When I digged up how the algorithm extracts orthonormal basis sequentially, their described algorithm does not return an orthonormal basis which I compared it with original authors' MATLAB code. I'm in the process of contact with the authors and added a note on function description that the current version of the code may not work well as expected. If you see specific issues in my code, I appreciate and welcome your PR.

nspyrison commented 3 years ago

Thanks. If I see the issue, I will send a PR.

Cheers

zhouhouchun commented 11 months ago

Hello, when I tried to use "library(Rdimtools)",there is ERROR: Error in dyn.load(dynlib <- getDynlib(dir)) : unable to load shared object '/Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library/rgl/libs/rgl.so': dlopen(/Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library/rgl/libs/rgl.so, 0x0006): Library not loaded: /opt/X11/lib/libGLU.1.dylib Referenced from: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library/rgl/libs/rgl.so Reason: tried: '/opt/X11/lib/libGLU.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/X11/lib/libGLU.1.dylib' (no such file), '/opt/X11/lib/libGLU.1.dylib' (no such file), '/Library/Frameworks/R.framework/Resources/lib/libGLU.1.dylib' (no such file), '/Library/Java/JavaVirtualMachines/jdk-11.0.18+10/Contents/Home/lib/server/libGLU.1.dylib' (no such file), '/var/folders/jf/s2f3w4sn4598204h_b6k28980000gn/T/rstudio-fallback-library-path-248379891/libGLU.1.dylib' (no such file) Error: package or namespace load failed for ‘Rdimtools’: .onLoad failed in loadNamespace() for 'rgl', details: call: rgl.init(initValue, onlyNULL) error: OpenGL is not available in this build In addition: Warning messages: 1: Loading rgl's DLL failed. This build of rgl depends on XQuartz, which failed to load. See the discussion in https://stackoverflow.com/a/66127391/2554330 2: Trying without OpenGL...

Could you help me?