Infotheory  1.0
Public Member Functions | Public Attributes | List of all members
infotheory.infotools.InfoTools Class Reference
Inheritance diagram for infotheory.infotools.InfoTools:

Public Member Functions

def __init__ (self, dims, nreps=0)
 
def display_config (self)
 
def display_snapshot (self)
 
def set_equal_interval_binning (self, nbins, mins, maxs)
 
def set_bin_boundaries (self, boundaries, dim_index=None)
 
def add_data_point (self, datapoint)
 
def add_data (self, data)
 
def clearAllData (self)
 
def __del__ (self)
 
def entropy (self, var_IDs)
 
def mutual_info (self, var_IDs)
 
def redundant_info (self, var_IDs)
 
def unique_info (self, var_IDs)
 
def synergy (self, var_IDs)
 

Public Attributes

 dims
 
 libc
 

Detailed Description

Python Wrapper class for InfoTools.h

This class loads the .so file from the compiled InfoTools.h that allows functions written in C++ to be called from Python. Create and object of this class to call associated functions.

Constructor & Destructor Documentation

◆ __init__()

def infotheory.infotools.InfoTools.__init__ (   self,
  dims,
  nreps = 0 
)
reads in .so file and creates object of InfoTools cpp class

ARGS
dims: (int) total dimensionality of all variables
nreps: (int) number of shifted binnings over which data is binned and averaged

◆ __del__()

def infotheory.infotools.InfoTools.__del__ (   self)
deletes the cpp pointer 

Member Function Documentation

◆ add_data()

def infotheory.infotools.InfoTools.add_data (   self,
  data 
)
add several data points at once

ARGS
data: (list-like, size=[number_of_datapoints, dims]) list of datapoints to be added

◆ add_data_point()

def infotheory.infotools.InfoTools.add_data_point (   self,
  datapoint 
)
add one data point to analyses

ARGS
datapoint: (list-like, size=dims) the datapoint to be added

◆ clearAllData()

def infotheory.infotools.InfoTools.clearAllData (   self)
clear all data added so far and start afresh

It is recommended to create a new object instead

◆ display_config()

def infotheory.infotools.InfoTools.display_config (   self)
Display the config for analyses such as number of bins, dimensionality etc. 

◆ display_snapshot()

def infotheory.infotools.InfoTools.display_snapshot (   self)
Display current status such as number of points added, number of non-empty bins etc. 

◆ entropy()

def infotheory.infotools.InfoTools.entropy (   self,
  var_IDs 
)
Compute entropy of random vars given by varIDs==0

ARGS:
varIDs: (list-like, size=dims) list to identify the dimensions of the data that need to be considered to estimate entropy

RETURNS:
Entropy of random variable made up by data along dimensins where varIDs==0

Example:
if dims = 4, 4D datapoints will be added, but if only the first 2 dimensions make up the variable of interest, then set
varIDs = [1,1,-1,-1]
The dims with varID==-1 will be ignored

◆ mutual_info()

def infotheory.infotools.InfoTools.mutual_info (   self,
  var_IDs 
)
Compute mutual information between two random vars for datapoints that have already been added.
The two variables are identified by varIDs==0 and varIDs==1.
Set varIDs=-1 for dimensions to be ignored.

ARGS:
varIDs: (list-like, size=dims) list of length equal to dimensionality of data

RETURNS:
Mutual information between vars defined by varIDs==0 and varIDs==1

Example:
if dims = 4, 4D datapoints will be added, but if only the first 2 dimensions make up one variable and the rest the other, then set
varIDs = [0,0,1,1]
The dims with varID==-1 will be ignored

◆ redundant_info()

def infotheory.infotools.InfoTools.redundant_info (   self,
  var_IDs 
)
Compute redundant information about a random var from two (or three) random vars for datapoints that have already been added.
The target random var is identified by varIDs==0
The sources are identified by varIDs==1 and varIDs==2 (and varIDs==3 in the case of three sources).
Set varIDs=-1 for dimensions to be ignored.

ARGS:
varIDs: (list-like, size=dims) list of length equal to dimensionality of data

RETURNS:
Redundant information from vars defined by varIDs==1 and varIDs==2 (optionally varIDs==3 in the case of three sources) about varIDs==0

Example:
if dims = 4, 4D datapoints will be added. If the first dimension denotes the target and the second and third denote the two sources, then set
varIDs = [0,1,2,-1]
The dims with varID==-1 will be ignored

◆ set_bin_boundaries()

def infotheory.infotools.InfoTools.set_bin_boundaries (   self,
  boundaries,
  dim_index = None 
)
set the left margin of each bin for each dimension

ARGS
boundaries: a list with a list of bin-margins for each dimension OR a list for just one dimension with dimension specified in dim_index.\n
Length of list = number_of_bins-1, left most bin is (-inf,list[0]) and right most bin is (list[-1],inf)
dim_index: (int, default=None) denoting the dimension for which the bins are being set, if boundaries is a single list of boundaries

◆ set_equal_interval_binning()

def infotheory.infotools.InfoTools.set_equal_interval_binning (   self,
  nbins,
  mins,
  maxs 
)
set binning mode to be equal interval binning

ARGS
nbins: (list,length=dims) list with the number of bins along each dimension
mins: (list,length=dims) list with the minimum values along each dimension
maxs: (list,length=dims) list with the maximum values along each dimension

◆ synergy()

def infotheory.infotools.InfoTools.synergy (   self,
  var_IDs 
)
Compute synergistic information about a random var from two (or three) random vars for datapoints that have already been added.
The target random var is identified by varIDs==0
The sources are identified by varIDs==1 and varIDs==2 (and varIDs==3 in the case of three sources).
Set varIDs=-1 for dimensions to be ignored.

ARGS:
varIDs: (list-like, size=dims) list of length equal to dimensionality of data

RETURNS:
Synergistic information from vars defined by varIDs==1 and varIDs==2 (and varIDs==3 in the case of three sources) about varIDs==0

Example:
if dims = 4, 4D datapoints will be added. If the first dimension denotes the target and the second and third denote the two sources, then set
varIDs = [0,1,2,-1]

◆ unique_info()

def infotheory.infotools.InfoTools.unique_info (   self,
  var_IDs 
)
Compute unique information about a random var from two (or three) random vars for datapoints that have already been added.
The target random var is identified by varIDs==0
The sources are identified by varIDs==1 and varIDs==2 (and varIDs==3 in the case of three sources).
Set varIDs=-1 for dimensions to be ignored.

ARGS:
varIDs: (list-like, size=dims) list of length equal to dimensionality of data

RETURNS:
Unique information from vars defined by varIDs==1 about varIDs==0 that is not redundant with varIDs==2 (or varIDs==3 in the case of three sources)

Example:
if dims = 4, 4D datapoints will be added. If the first dimension denotes the target and the second and third denote the two sources, then set
varIDs = [0,1,2,-1]