Quantum Fog  0.9.3
Static Public Member Functions | List of all members
learning.DataEntropy.DataEntropy Class Reference

Static Public Member Functions

def ent (df, xcols, verbose=False)
 
def cond_info (df, xcols, ycols, verbose=False)
 
def mut_info (df, xcols, ycols, verbose=False)
 
def cond_mut_info (df, xcols, ycols, zcols, verbose=False)
 

Detailed Description

This class calculates classical (not quantum yet) entropy, conditional
information (CI), mutual information (MI) and conditional mutual info (
CMI) from a dataframe (hence, from empirical data, not from the true
distributions of a bnet).

Error in entropy is ln(n+1) - ln(n) \approx 1/n where n>>1 is the number
of samples

Member Function Documentation

def learning.DataEntropy.DataEntropy.cond_info (   df,
  xcols,
  ycols,
  verbose = False 
)
static
Returns the conditional information (CI) H(x|y) where x (y,
resp.) is given by the list of columns xcols (ycols, resp.) in the
dataframe df.

Parameters
----------
df : pandas.DataFrame
    dataframe for which CI is calculated
xcols : list[str]
    list of column names in df. The x in H(x:y)
ycols : list[str]
    list of column names in df. The y in H(x:y)
verbose : bool
    If True, print extra info in console.

Returns
-------
float
def learning.DataEntropy.DataEntropy.cond_mut_info (   df,
  xcols,
  ycols,
  zcols,
  verbose = False 
)
static
Returns the conditional mutual information (CMI) H(x:y|z) where x (
y, z, resp.) is given by the list of columns xcols (ycols, zcols,
resp.) in the dataframe df.


Parameters
----------
df : pandas.DataFrame
    dataframe for which CMI is calculated
xcols : list[str]
    list of column names in df. The x in H(x:y|z)
ycols : list[str]
    list of column names in df. The y in H(x:y|z)
zcols : list[str]
    list of column names in df. The z in H(x:y|z)
verbose : bool
    If True, print extra info in console.

Returns
-------
float
def learning.DataEntropy.DataEntropy.ent (   df,
  xcols,
  verbose = False 
)
static
Returns the entropy H(x) where x is given by the list of columns
xcols in the dataframe df.

Parameters
----------
df : pandas.DataFrame
    dataframe for which entropy is calculated
xcols : list[str]
    list of column names in df. The x in H(x)
verbose : bool
    If True, print extra info in console.

Returns
-------
float
def learning.DataEntropy.DataEntropy.mut_info (   df,
  xcols,
  ycols,
  verbose = False 
)
static
Returns the mutual information (MI) H(x:y) where x (y, resp.) is
given by the list of columns xcols (ycols, resp.) in the dataframe df.

Parameters
----------
df : pandas.DataFrame
    dataframe for which MI is calculated
xcols : list[str]
    list of column names in df. The x in H(x:y)
ycols : list[str]
    list of column names in df. The y in H(x:y)
verbose : bool
    If True, print extra info in console.

Returns
-------
float

The documentation for this class was generated from the following file: