RAPLER / dst-1

Combine basic probability assignments with Dempster's rule of combination
6 stars 3 forks source link

sparseM bug report: bca size reduced after combination #15

Closed garyzhubc closed 1 year ago

garyzhubc commented 1 year ago

With the newest bca_mod, bca size reduced from 501 to 499 after combination.

> # initialize loop
> bpa <- comp_bca(pcsk9_updown_bigsnp_obj, ukb_data_ldl, start_pat, 3, 4, trunc_thres_lower, trunc_thres_upper, wholeset, range, masses, rsid)
> dim(bpa$tt)
[1]   2 501
> bpa_new <- comp_bca(pcsk9_updown_bigsnp_obj, ukb_data_ldl, start_pat+1, 3, 4, trunc_thres_lower, trunc_thres_upper, wholeset, range, masses, rsid)
> dim(bpa_new$tt)
[1]   2 501
> bpa1 <- dsrwon(bpa, bpa_new, sparseM, m_cores)
> dim(bpa1$tt)
[1]   4 499

The bug only exists when sparseM == TRUE

> bpa2 <- dsrwon(bpa, bpa_new, FALSE, m_cores)
> dim(bpa2$tt)
[1]   4 501
garyzhubc commented 1 year ago

This is installed with

library(devtools)
install_github("RAPLER/dst-1", ref="bca_mod")
RAPLER commented 1 year ago

If I try your last line of code on two bca's, the way you write it, I obtain this:

dsrwon(y1s, y2s, sparseM, m_cores) Error in dsrwon(y1s, y2s, sparseM, m_cores) : objet 'sparseM' introuvable.I would like to know what values you chose for these two parameters:

sparseM m_cores

Le jeu. 28 sept. 2023 à 20:33, Peiyuan Zhu @.***> a écrit :

bca size reduced after combination

initialize loop

bpa <- comp_bca(pcsk9_updown_bigsnp_obj, ukb_data_ldl, start_pat, 3, 4, trunc_thres_lower, trunc_thres_upper, wholeset, range, masses, rsid) dim(bpa$tt) [1] 2 501 bpa_new <- comp_bca(pcsk9_updown_bigsnp_obj, ukb_data_ldl, start_pat+1, 3, 4, trunc_thres_lower, trunc_thres_upper, wholeset, range, masses, rsid) dim(bpa_new$tt) [1] 2 501 bpa <- dsrwon(bpa, bpa_new, sparseM, m_cores) dim(bpa$tt) [1] 4 499

— Reply to this email directly, view it on GitHub https://github.com/RAPLER/dst-1/issues/15, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA5D5IMSNHPCTFHTQQ4VL2DX4YJMPANCNFSM6AAAAAA5LXKWVI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

garyzhubc commented 1 year ago

sparseM=TRUE mcores=“yes”

On Sep 28, 2023, at 6:02 PM, Claude Boivin @.***> wrote: If I try your last line of code on two bca's, the way you write it, I

obtain this:

dsrwon(y1s, y2s, sparseM, m_cores)

Error in dsrwon(y1s, y2s, sparseM, m_cores) : objet 'sparseM' introuvable.I

would like to know what values you chose for these two parameters:

sparseM

m_cores

Le jeu. 28 sept. 2023 à 20:33, Peiyuan Zhu @.***> a

écrit :

bca size reduced after combination

initialize loop

bpa <- comp_bca(pcsk9_updown_bigsnp_obj, ukb_data_ldl, start_pat, 3, 4, trunc_thres_lower, trunc_thres_upper, wholeset, range, masses, rsid)

dim(bpa$tt)

[1] 2 501

bpa_new <- comp_bca(pcsk9_updown_bigsnp_obj, ukb_data_ldl, start_pat+1, 3, 4, trunc_thres_lower, trunc_thres_upper, wholeset, range, masses, rsid)

dim(bpa_new$tt)

[1] 2 501

bpa <- dsrwon(bpa, bpa_new, sparseM, m_cores)

dim(bpa$tt)

[1] 4 499

Reply to this email directly, view it on GitHub

https://github.com/RAPLER/dst-1/issues/15, or unsubscribe

https://github.com/notifications/unsubscribe-auth/AA5D5IMSNHPCTFHTQQ4VL2DX4YJMPANCNFSM6AAAAAA5LXKWVI

.

You are receiving this because you are subscribed to this thread.Message

ID: @.***>

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

garyzhubc commented 1 year ago

the problem persist after mcores="no"

Error in dsrwon(bpa, bpa_new, sparseM, m_cores) : Nb of elements of frame x and frame y not equal.

RAPLER commented 1 year ago

About the bug: "bca size reduced after combination", this situation will arrive when one column contains only zeroes. with a "regular" matrix, the column of zeroes stay there. With sparse matrices, the column of zeroes is removed. Are you sure the last row of your bca is a vector of 501 "ones" (the frame)?

As for the second error message "Error in dsrwon(bpa, bpa_new, sparseM, m_cores) : Nb of elements of frame x and frame y not equal.", it will occur when the frame of the two bca's combinned is different (499 columns vs 501, for example).

I will try to reproduce your situation.

garyzhubc commented 1 year ago

Yes, the input bca has 501 "ones" and the output bca has 499 ones. So the size shrinked.

> bpa <- comp_bca(pcsk9_updown_bigsnp_obj, ukb_data_ldl, start_pat, 3, 4, trunc_thres_lower, trunc_thres_upper, wholeset, range, masses, rsid)
> sum(bpa$tt[2,])
[1] 501
> bpa_new <- comp_bca(pcsk9_updown_bigsnp_obj, ukb_data_ldl, 2, 3, 4, trunc_thres_lower, trunc_thres_upper, wholeset, range, masses, rsid)
> sum(bpa_new$tt[2,])
[1] 501
> m_cores <- "yes"
> sparseM <- TRUE
> bpa1 <- dsrwon(bpa, bpa_new, sparseM, m_cores)
> sum(bpa1$tt[4,])
[1] 499
garyzhubc commented 1 year ago

As @RAPLER mentioned this is an issue of duplicated labels.

RAPLER commented 1 year ago

This issue should be resolved if the latest version of function bca is used. See commit a55f12c on bca function.