Closed dynaryu closed 1 year ago
I would rather keep it. It is a common mistake that a user puts wrong numbers in a probability vector, and one of the smoking guns is that the probability vector does not sum up to 1. So I personally find the warning message useful to detect errors in input data.
I was not sure whether the process should stop due to this or not. Or this condition should be checked in advance not in the sampling function. Anyway, we can discuss later on. What about the probability vector? Do I understand correctly? What I see here is the probability vector (originally 2x1) sums up to 1 in the first iteration, but at the next iteration it became 4x1 vector.
And what would be the expected outcome of singleSample.m given the input? I'd like to check if the function is working properly or not. Can you share the output as I don't have the statistics toolbox.
As of the probability vector, if a random variable has a probability vector [0.99, 0.01, 0.9, 0.1], it would have an event matrix, for example, [1 1; 2 1; 2 1; 2 2] with the second column standing for a parent node’s states. Then, since all parent nodes must have been sampled before the random variable being sampled, when it comes to sampling this random variable, its parent node must have been already sampled to either State 1 or 2, which would then make the probability vector either [0.99, 0.01] or [0.9, 0.1], respectively. This is why there is an error message (in Line 46) “error( 'Given CPMs include undefined parent nodes' )”, which prevents MCS from going forward if there is any parent node that has not been sampled.
From: Hyeuk Ryu @.> Sent: Friday, March 17, 2023 10:08 AM To: jieunbyun/BNS-JT @.> Cc: Ji-Eun Byun @.>; Comment @.> Subject: Re: [jieunbyun/BNS-JT] randomsample implementation (Issue #6)
What about the probability vector? Do I understand correctly?
— Reply to this email directly, view it on GitHubhttps://github.com/jieunbyun/BNS-JT/issues/6#issuecomment-1473591604, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFIK4XYQH3M6PASTM2ZEPQLW4QZZHANCNFSM6AAAAAAV53IOF4. You are receiving this because you commented.Message ID: @.**@.>>
I revised the function to use “rand” instead of “randsample”. Now the function should run without Statistics Toolbox. Just let me know if the issue persists.
From: Hyeuk Ryu @.> Sent: Friday, March 17, 2023 10:17 AM To: jieunbyun/BNS-JT @.> Cc: Ji-Eun Byun @.>; Comment @.> Subject: Re: [jieunbyun/BNS-JT] randomsample implementation (Issue #6)
And what would be the expected outcome of singleSample.m given the input? I'd like to check if the function is working properly or not. Can you share the output as I don't have the statistics toolbox.
— Reply to this email directly, view it on GitHubhttps://github.com/jieunbyun/BNS-JT/issues/6#issuecomment-1473609043, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFIK4X2GM6T7HD32AULKK63W4Q2YHANCNFSM6AAAAAAV53IOF4. You are receiving this because you commented.Message ID: @.**@.>>
In the singleSample.m
Can I just ignore this warning? BTW, I don't have the statistics toolbox. If cpmToSample.p is [0.99, 0.01, 0.9, 0.1], then what should be the probability vector for random sampling? It looks like it is re-evalued as [0.99, 0.01, 0.9, 0.1]/sum of the vector.