ELIFE-ASU / Inform

A cross platform C library for information analysis of dynamical systems

Home Page:https://elife-asu.github.io/Inform

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multivariate Mutual Information

dglmoore opened this issue · comments

The current implementation of mutual information can compute the mutual information between two time-series. However, some applications, such as integration measures, require calculating the mutual information between more than two variables.

Proposed API Change

EXPORT double inform_mutual_info(int const *series, size_t l, size_t n, size_t m, int b,
    inform_error *err);
EXPORT double *inform_mutual_info(int const *series, size_t l, size_t n, size_t m, int b,
    double *mi, inform_error *err);

Example Usage

#include <assert.h>
#include <inform/mutual_info.h>
#include <stdio.h>

int main()
{
    int series[5] = {
        0, 1, 1, 0, 1,
        1, 1, 0, 1, 1,
        0, 1, 1, 0, 1,
    }

    inform_error err = INFORM_SUCCESS;
    double mi = inform_mutual_info(series, 3, 1, 5, 2, &err);
    assert(inform_succeeded(&err));
    printf("%0.6lf\n", mi); // 7.828819
}