We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dd82082 commit 965b479Copy full SHA for 965b479
1 file changed
pybnesian/learning/independences/hybrid/mixed_knncmi.cpp
@@ -124,6 +124,10 @@ double mi_general(VPTree& ztree,
124
for (auto i = 0; i < n_rows; ++i) {
125
eps(i) = knn_results[i].first(k);
126
k_hat(i) = knn_results[i].second.size();
127
+ if (k == 1 && eps(i) == 1.0) {
128
+ k_hat(i) = 1;
129
+ eps(i) = 0.0;
130
+ }
131
}
132
133
// use the ztree to search in all Z, XZ and YZ subspaces
@@ -159,6 +163,10 @@ double mi_pair(VPTree& ytree,
159
163
160
164
eps(i) = knn_results[i].first[k];
161
165
166
167
168
169
162
170
171
172
auto x_is_discrete_column = std::vector<bool>(is_discrete_column.begin(), is_discrete_column.begin() + 1);
0 commit comments