Closed franck-simon closed 3 years ago
It happens when:
sample_weights
are initialized automatically by a uniform weight based on n_eff
,
https://github.com/miicTeam/miic_R_package/blob/50e15f4f1f5aeb6443e2a84c8cf8f96d8a1f8aa7/src/r_cpp_interface.cpp#L92-L94n_eff
is later re-evaluated as the sum of weights of non-NA samples during the computation, which may lead to the above shift due to loss of precision.
https://github.com/miicTeam/miic_R_package/blob/50e15f4f1f5aeb6443e2a84c8cf8f96d8a1f8aa7/src/computation_discrete.cpp#L28
https://github.com/miicTeam/miic_R_package/blob/50e15f4f1f5aeb6443e2a84c8cf8f96d8a1f8aa7/src/computation_continuous.cpp#L320
https://github.com/miicTeam/miic_R_package/blob/50e15f4f1f5aeb6443e2a84c8cf8f96d8a1f8aa7/src/computation_continuous.cpp#L471
Because of precision loss, the n_eff value can be wrongly shifted by 1 when computing the mutual information: