Fitness
pangadfs.fitness
¶
FitnessDefault()
¶
Bases: FitnessBase
Source code in pangadfs/base.py
fitness(*, population, points, **kwargs)
¶
Assesses population fitness using supplied mapping
Parameters:
Name | Type | Description | Default |
---|---|---|---|
population
|
ndarray
|
the population to assess fitness |
required |
points
|
ndarray
|
1D array of projected points in same order as pool |
required |
**kwargs
|
Arbitrary keyword arguments |
{}
|
Returns:
Type | Description |
---|---|
np.ndarray: 1D array of float |
Source code in pangadfs/fitness.py
FitnessMultiOptimizerFieldOwnership¶
The FitnessMultiOptimizerFieldOwnership
class is a fitness calculator for multi-objective optimization with field ownership. It calculates a composite fitness score based on three components:
- Score: The projected score of the lineups.
- Diversity: The uniqueness of the lineups compared to each other.
- Field Ownership: The projected ownership of the players in the lineups.
The fitness function is a weighted sum of these three components. The weights can be configured in the ga_settings
of the context object.
fitness
¶
pangadfs.fitness_multioptimizer_field_ownership.FitnessMultiOptimizerFieldOwnership.fitness(population_sets, points, ownership, top_k, diversity_method, weights, strategy)
¶
Calculates the multi-objective fitness for each lineup set.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
population_sets
|
ndarray
|
The population of lineup sets. |
required |
points
|
ndarray
|
The points for each player. |
required |
ownership
|
ndarray
|
The ownership for each player. |
required |
top_k
|
int
|
The number of top lineups to consider for the score component. |
required |
diversity_method
|
str
|
The method to calculate diversity. |
required |
weights
|
tuple
|
The weights for (score, diversity, ownership). |
required |
strategy
|
str
|
The ownership strategy ('contrarian', 'leverage', 'balanced'). |
required |
Returns:
Type | Description |
---|---|
ndarray
|
np.ndarray: The fitness score for each lineup set. |