From 7cffda517a98bdf3c0c193bcf4aefb82f8b4e104 Mon Sep 17 00:00:00 2001 From: vcabeli Date: Tue, 28 Jul 2020 11:52:17 +0200 Subject: [PATCH] Reverted commit ec593e with fix --- src/info_cnt.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/info_cnt.cpp b/src/info_cnt.cpp index de64cba..d61bdbe 100755 --- a/src/info_cnt.cpp +++ b/src/info_cnt.cpp @@ -32,7 +32,7 @@ void reset_u_cutpoints(int** cut, int nbrUi, vector ptr_cnt, for (int j = init_nbin; j < maxbins; j++) { cut[l][j] = 0; } - r[l] = init_nbin; + r[l] = min(init_nbin, AllLevels[ptrVarIdx[l]]); } else { r[l] = AllLevels[ptrVarIdx[l]]; } @@ -943,7 +943,7 @@ vector compute_Ixy_cond_u_new_alg1(vector > data, } // Reset cutpoints on U - reset_u_cutpoints(cut, nbrUi, ptr_cnt, ptrVarIdx, max_initbins, maxbins, lbin, + reset_u_cutpoints(cut, nbrUi, ptr_cnt, ptrVarIdx, initbins, maxbins, lbin, r, AllLevels, n); for (l = 0; l < nbrUi; l++) { if (ptr_cnt[ptrVarIdx[l + 2]] == 1) @@ -1034,7 +1034,7 @@ vector compute_Ixy_cond_u_new_alg1(vector > data, cut[1], &(r[1]), sample_weights, flag_sample_weights, environment); // 2 factors } // Reset cutpoints on U - reset_u_cutpoints(cut, nbrUi, ptr_cnt, ptrVarIdx, max_initbins, maxbins, lbin, + reset_u_cutpoints(cut, nbrUi, ptr_cnt, ptrVarIdx, initbins, maxbins, lbin, r, AllLevels, n); for (l = 0; l < nbrUi; l++) { if (ptr_cnt[ptrVarIdx[l + 2]] == 1) @@ -1090,7 +1090,7 @@ vector compute_Ixy_cond_u_new_alg1(vector > data, I_x_u = res_temp[0]; // After optimization on U. Ik_x_u = res_temp[1]; // Reset cutpoints on U - reset_u_cutpoints(cut, nbrUi, ptr_cnt, ptrVarIdx, max_initbins, maxbins, lbin, + reset_u_cutpoints(cut, nbrUi, ptr_cnt, ptrVarIdx, initbins, maxbins, lbin, r, AllLevels, n); for (l = 0; l < nbrUi; l++) { if (ptr_cnt[ptrVarIdx[l + 2]] == 1) @@ -1149,7 +1149,7 @@ vector compute_Ixy_cond_u_new_alg1(vector > data, I_y_u = res_temp[0]; // After optimization on U. Ik_y_u = res_temp[1]; // Reset cutpoints on U - reset_u_cutpoints(cut, nbrUi, ptr_cnt, ptrVarIdx, max_initbins, maxbins, lbin, + reset_u_cutpoints(cut, nbrUi, ptr_cnt, ptrVarIdx, initbins, maxbins, lbin, r, AllLevels, n); for (l = 0; l < nbrUi; l++) { if (ptr_cnt[ptrVarIdx[l + 2]] == 1)