コード例 #1
0
def get_difference(function_pair,
                   count_matrices,
                   average_calculation,
                   poly_postprocessing,
                   exp_postprocessing):
    """
    Retrieves the difference between two functions using the munkres algorithm.

    :param function_pair:       A tuple containing both indices for the
                                count_matrices dictionary.
    :param count_matrices:      A dictionary holding CMs.
    :param average_calculation: If set to true the difference calculation
                                function will take the average of all variable
                                differences as the difference, else it will
                                normalize the function as a whole and thus
                                weighting in variables dependent on their size.
    :param poly_postprocessing: If set to true, the difference value of big
                                function pairs will be reduced using a
                                polynomial approach.
    :param exp_postprocessing:  If set to true, the difference value of big
                                function pairs will be reduced using an
                                exponential approach.
    :return:                    A tuple containing both function ids and their
                                difference.
    """
    function_1, function_2 = function_pair
    return (function_1,
            function_2,
            compare_functions(count_matrices[function_1],
                              count_matrices[function_2],
                              average_calculation,
                              poly_postprocessing,
                              exp_postprocessing))
コード例 #2
0
def get_difference(function_pair, count_matrices, average_calculation,
                   poly_postprocessing, exp_postprocessing):
    """
    Retrieves the difference between two functions using the munkres algorithm.

    :param function_pair:       A tuple containing both indices for the
                                count_matrices dictionary.
    :param count_matrices:      A dictionary holding CMs.
    :param average_calculation: If set to true the difference calculation
                                function will take the average of all variable
                                differences as the difference, else it will
                                normalize the function as a whole and thus
                                weighting in variables dependent on their size.
    :param poly_postprocessing: If set to true, the difference value of big
                                function pairs will be reduced using a
                                polynomial approach.
    :param exp_postprocessing:  If set to true, the difference value of big
                                function pairs will be reduced using an
                                exponential approach.
    :return:                    A tuple containing both function ids and their
                                difference.
    """
    function_1, function_2 = function_pair
    return (function_1, function_2,
            compare_functions(count_matrices[function_1],
                              count_matrices[function_2], average_calculation,
                              poly_postprocessing, exp_postprocessing))