예제 #1
0
def get_population_iqr(population, n_objectives):
    """
    Compute the inter-quartile range (IQR) of the population regarding
    each objective.

    :param population: The input population
    :param n_objectives: Total number of objectives
    :return: List with the IQR regarding each objective
    """

    # Initialise base IQR as 0 for each objective
    iqr = [0 for _ in range(n_objectives)]

    for m in range(n_objectives):
        # Iterate over all objectives

        # Sort the population with respect to the current objective.
        sorted_pop = sorted(
            population,
            key=lambda ind: params['FITNESS_FUNCTION'].value(ind.fitness, m),
            reverse=params['FITNESS_FUNCTION'].fitness_functions[m].maximise)

        # Get the inter-quartile fitness ranges for the current objective.
        iqr[m] = (params['FITNESS_FUNCTION'].value(
            percentile(sorted_pop, 75).fitness, m) -
                  params['FITNESS_FUNCTION'].value(
                      percentile(sorted_pop, 25).fitness, m))
    return iqr
예제 #2
0
파일: NSGA2.py 프로젝트: jmmcd/PonyGE2
def get_population_iqr(population, n_objectives):
    """
    Compute the inter-quartile range (IQR) of the population regarding
    each objective.

    :param population: The input population
    :param n_objectives: Total number of objectives
    :return: List with the IQR regarding each objective
    """

    # Initialise base IQR as 0 for each objective
    iqr = [0 for _ in range(n_objectives)]

    for m in range(n_objectives):
        # Iterate over all objectives

        # Sort the population with respect to the current objective.
        sorted_pop = sorted(population, key=lambda ind:
                            params['FITNESS_FUNCTION'].value(ind.fitness, m),
                            reverse=params['FITNESS_FUNCTION'].
                            fitness_functions[m].maximise)

        # Get the inter-quartile fitness ranges for the current objective.
        iqr[m] = (params['FITNESS_FUNCTION'].value(percentile(sorted_pop,
                                                              75).fitness, m) -
                  params['FITNESS_FUNCTION'].value(percentile(sorted_pop,
                                                              25).fitness, m))
    return iqr
예제 #3
0
def get_population_iqr(population, n_objectives):
    """
    Compute the interquartile range (IQR) of the population regarding
    each objective. 
    :param population: The input population 
    :param n_objectives: Total number of objectives
    :return: List with the IQR regarding each objective 
    """
    iqr = [0] * n_objectives
    for m in range(n_objectives):
        sorted_pop = sorted(population, key=lambda ind: value(ind.fitness, m))
        iqr[m] = (value(percentile(sorted_pop, 75).fitness, m) -
                  value(percentile(sorted_pop, 25).fitness, m))
    return iqr