Chapter 01, relatEntropy: Cannot operate Px and Py together
Nosferath opened this issue · 1 comments
Nosferath commented
I have been testing this library with two dummy matrixes:
a = [[10, 73, 55, 83, 84, 2, 9, 8, 88, 48];
[21, 76, 4, 31, 100, 51, 63, 44, 91, 97];
[80, 19, 82, 53, 40, 45, 10, 79, 94, 11];
[69, 57, 60, 63, 90, 86, 4, 31, 41, 55];
[47, 7, 41, 1, 54, 51, 33, 74, 29, 31];
[90, 69, 65, 78, 9, 12, 65, 11, 77, 16];
[41, 67, 37, 22, 42, 80, 59, 18, 95, 43];
[66, 14, 100, 21, 2, 94, 68, 93, 28, 33];
[96, 90, 71, 80, 91, 86, 80, 79, 38, 56];
[31, 17, 20, 27, 38, 16, 39, 78, 28, 19]];
b = [[22, 34, 28, 56, 62, 72, 51, 32, 14, 6];
[57, 30, 53, 75, 19, 33, 23, 46, 2, 52];
[91, 51, 34, 28, 22, 4, 84, 54, 37, 12];
[70, 85, 28, 39, 81, 82, 12, 79, 2, 65];
[89, 95, 38, 76, 11, 5, 100, 42, 48, 17];
[75, 85, 99, 50, 68, 30, 76, 91, 14, 7];
[45, 55, 76, 67, 20, 31, 52, 13, 85, 56];
[12, 53, 45, 91, 38, 54, 48, 88, 96, 15];
[94, 53, 85, 34, 54, 13, 28, 66, 20, 37];
[60, 63, 51, 30, 26, 80, 97, 44, 74, 21]];
All functions work fine with them, except for relatEntropy
. In lines 21 and 22 the vectors end up having different lengths (due to different number of nonzero values) and they cannot be substracted in line 24. MATLAB throws Matrix dimensions must agree. Error in relatEntropy (line 24) z = -dot(Px,log2(Py)-log2(Px));
Nosferath commented
Why was this closed without explaination?