ELIFE-ASU / Inform

A cross platform C library for information analysis of dynamical systems
https://elife-asu.github.io/Inform
MIT License
21 stars 3 forks source link

Cross Entropy #55

Closed dglmoore closed 7 years ago

dglmoore commented 7 years ago

We have already defined mutual information and relative entropy between time series and between distributions. Let's round out the basic measures with cross entropy!

Proposed API

EXPORT double* inform_cross_entropy(const int *p, const int *q, size_t n, size_t m, int b,
    inform_error *err);

Example Usage

int p[10] = {0,1,1,0,1,0,0,1,0,0}; (6,4)
int q[10] = {1,1,1,0,1,1,0,0,0,1}; (4,6)
inform_error err = INFORM_SUCCESS;
inform_cross_entropy(p, q, 1, 10, &err); // 1.087943