Skip to content

Batch fitness_func evaluation / scoring #136

Description

@linanqiu

Feature request to support evaluating fitness_func in batched / vectorized way (e.g. for the entire population / sub-batches of the population at once). This is very useful for cases where the fitness_func benefits from vectorization. One example is when fitness_func itself calls an ML model's prediction function. The model's prediction function benefits from batching e.g. predicting 1 million rows is 10x slower than predicting 10 rows. Hence I'd like to suggest a feature request (and possibly submit a PR) for batch evaluating fitness_func.

Conceptually, this should just be taking the

foriinrange(len(population)):
solution[i] =fitness_func(population[i])

and doing the following:

func_batch_size=100foriinrange(ceiling(len(population) /func_batch_size)):
batch_indices=range(i*func_batch_size, min(population, (i+1*func_batch_size))
solution[batch_indices] =fitness_func_batch(population[batch_indices])

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions