(data, variables)
return values, table
Construct a 'Burt table' (all values cross-tabulation) for variables.

    Return and ordered list of (variable, value) pairs and a
    numpy.ndarray contingency

    :param Orange.data.Table data: Data table.
    :param variables: List of variables (discrete).
    :type variables: list of Orange.data.DiscreteVariable
Construct a 'Burt table' (all values cross-tabulation) for variables.
Construct a Burt table ( all values cross - tabulation ) for variables .
def burt_table(data, variables):
    """
    Construct a 'Burt table' (all values cross-tabulation) for variables.

    Return and ordered list of (variable, value) pairs and a
    numpy.ndarray contingency

    :param Orange.data.Table data: Data table.
    :param variables: List of variables (discrete).
    :type variables: list of Orange.data.DiscreteVariable

    """
    values = [(var, value) for var in variables for value in var.values]

    table = np.zeros((len(values), len(values)))
    counts = [len(attr.values) for attr in variables]
    offsets = np.r_[0, np.cumsum(counts)]

    for i in range(len(variables)):
        for j in range(i + 1):
            var1 = variables[i]
            var2 = variables[j]

            cm = contingency.get_contingency(data, var2, var1)

            start1, end1 = offsets[i], offsets[i] + counts[i]
            start2, end2 = offsets[j], offsets[j] + counts[j]

            table[start1: end1, start2: end2] += cm
            if i != j:
                table[start2: end2, start1: end1] += cm.T

    return values, table
def burt_table ( data , variables ) : values = [ ( var , value ) for var in variables for value in var . values ] table = np . zeros ( ( len ( values ) , len ( values ) ) ) counts = [ len ( attr . values ) for attr in variables ] offsets = np . r_ [ 0 , np . cumsum ( counts ) ] for i in range ( len ( variables ) ) : for j in range ( i + 1 ) : var1 = variables [ i ] var2 = variables [ j ] cm = contingency . get_contingency ( data , var2 , var1 ) start1 , end1 = offsets [ i ] , offsets [ i ] + counts [ i ] start2 , end2 = offsets [ j ] , offsets [ j ] + counts [ j ] table [ start1 : end1 , start2 : end2 ] += cm if i != j : table [ start2 : end2 , start1 : end1 ] += cm . T return values , table