Closed l-ramirez-lopez closed 1 year ago
Browse[1]> str(dsm)
List of 2
$ dissimilarity: num [1:825, 1] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN ...
..- attr(*, "dimnames")=List of 2
.. ..$ : chr [1:825] "Xr_1" "Xr_2" "Xr_3" "Xr_4" ...
.. ..$ : chr "Xu_1"
$ documentation: chr(0)
Browse[1]> ls()
[1] "center" "diss_method" "documentation"
[4] "dsm" "input_dots" "k"
[7] "k_diss" "k_range" "kk"
[10] "pc_selection" "return_dissimilarity" "return_projection"
[13] "scale" "spike" "ws"
[16] "Xr" "Xu" "Yr"
Browse[1]> str(colMeans(X))
Named num [1:700] 0.357 0.356 0.356 0.356 0.355 ...
- attr(*, "names")= chr [1:700] "1100" "1102" "1104" "1106" ...
Browse[1]> str(colMeans(Xu))
Named num [1:700] 0.357 0.356 0.356 0.356 0.355 ...
- attr(*, "names")= chr [1:700] "1100" "1102" "1104" "1106" ...
@l-ramirez-lopez by your code definition above, the unknown sample is identical to the matrix column mean of Xr
. The resulting distance matrix is then not a number.
ok see this is something in fast_diss
armadillo impl.
Browse[1]> Xu <- matrix(c(rep(0, 699), 1), nrow = 1)
Browse[1]> str(fast_diss(Xu, Xr, "cor"))
num [1:825, 1] 0.483 0.546 0.525 0.551 0.444 ...
Browse[1]> Xu <- matrix(rep(0, 700), nrow = 1)
Browse[1]> str(fast_diss(Xu, Xr, "cor"))
num [1:825, 1] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN ...
question is, how do you wanna treat NaN
output? Error in the first place?
@philipp-baumann you are right, the error is actually in the fast_diss()
function used by cor_diss()
A sanity check was added. Correlation coefficients for observations with an standard deviation of 0 cannot be computed.
Error: