Add Conditional Entropy
dglmoore opened this issue · comments
As a generalization of entropy rate, it would be able to compute the conditional entropy between two timeseries.
Proposed API:
double inform_conditional_entropy(int const *xs, int const *ys, size_t n,
int bx, int by, double b, inform_error *err);
double *inform_local_conditional_entropy(int const *xs, int const *ys, size_t n,
int bx, int by, double b, double *lce, inform_error *err)
Example Usage:
#define N 9
int xs[N] = {0,0,1,1,1,1,0,0,0};
int ys[N] = {1,0,0,1,0,0,1,0,0};
inform_error err = INFORM_SUCCESS;
inform_conditional_entropy(xs, ys, N, 2, 2, 2.0, &err); // == 0.899985
inform_conditional_entropy(ys, xs, N, 2, 2, 2.0, &err); // == 0.972765
double lce[N];
inform_conditional_entropy(xs, ys, N, 2, 2, 2.0, lce, &err); // == lce
// lce == {1.322 0.737, 0.415, 2.000, 0.415, 0.415, 1.322, 0.737, 0.737}
inform_conditional_entropy(ys, xs, N, 2, 2, 2.0, lce, &err); // == lce
// lce == {0.585, 1.000, 1.000, 1.585, 1.000, 1.000, 0.585, 1.000, 1.000}