mdr/utils/utils.py
def mdr_conditional_entropy(X, Y, labels, base=2):
    """Calculates the MDR conditional entropy, H(XY|labels), in the given base

    MDR conditional entropy is calculated by combining variables X and Y into a single MDR model then calculating
    the entropy of the resulting model's predictions conditional on the provided labels.

    Parameters
    ----------
    X: array-like (# samples)
        An array of values corresponding to one feature in the MDR model
    Y: array-like (# samples)
        An array of values corresponding to one feature in the MDR model
    labels: array-like (# samples)
        The class labels corresponding to features X and Y
    base: integer (default: 2)
        The base in which to calculate MDR conditional entropy

    Returns
    ----------
    mdr_conditional_entropy: float
        The MDR conditional entropy calculated according to the equation H(XY|labels) = H(XY,labels) - H(labels)

    """
    return conditional_entropy(_mdr_predict(X, Y, labels), labels, base=base)
def mdr_conditional_entropy(X, Y, labels, base=2):
    """Calculates the MDR conditional entropy, H(XY|labels), in the given base

    MDR conditional entropy is calculated by combining variables X and Y into a single MDR model then calculating
    the entropy of the resulting model's predictions conditional on the provided labels.

    Parameters
    ----------
    X: array-like (# samples)
        An array of values corresponding to one feature in the MDR model
    Y: array-like (# samples)
        An array of values corresponding to one feature in the MDR model
    labels: array-like (# samples)
        The class labels corresponding to features X and Y
    base: integer (default: 2)
        The base in which to calculate MDR conditional entropy

    Returns
    ----------
    mdr_conditional_entropy: float
        The MDR conditional entropy calculated according to the equation H(XY|labels) = H(XY,labels) - H(labels)

    """
    return conditional_entropy(_mdr_predict(X, Y, labels), labels, base=base)
Calculates the MDR conditional entropy, H(XY|labels), in the given base

    MDR conditional entropy is calculated by combining variables X and Y into a single MDR model then calculating
    the entropy of the resulting model's predictions conditional on the provided labels.

    Parameters
    ----------
    X: array-like (# samples)
        An array of values corresponding to one feature in the MDR model
    Y: array-like (# samples)
        An array of values corresponding to one feature in the MDR model
    labels: array-like (# samples)
        The class labels corresponding to features X and Y
    base: integer (default: 2)
        The base in which to calculate MDR conditional entropy

    Returns
    ----------
    mdr_conditional_entropy: float
        The MDR conditional entropy calculated according to the equation H(XY|labels) = H(XY,labels) - H(labels)