slim_gsgp.algorithms.SLIM_GSGP.representations
slim_gsgp.algorithms.SLIM_GSGP.representations.individual
slim_gsgp.algorithms.SLIM_GSGP.representations.population
Population Class for SLIM GSGP using PyTorch.
- class slim_gsgp.algorithms.SLIM_GSGP.representations.population.Population(population)[source]
Bases:
object- calculate_semantics(inputs, testing=False)[source]
Calculate the semantics for each individual in the population.
- Parameters:
inputs (torch.Tensor) – Input data for calculating semantics.
testing (bool, optional) – Boolean indicating if the calculation is for testing semantics.
- Return type:
None
- evaluate(ffunction, y, operator='sum', n_jobs=1)[source]
Evaluate the population using a fitness function.
- Parameters:
ffunction (Callable) – Fitness function to evaluate the individuals.
y (torch.Tensor) – Expected output (target) values.
operator (str, optional) – Operator to apply to the semantics (“sum” or “prod”). Default is “sum”.
n_jobs (int, optional) – The maximum number of concurrently running jobs for joblib parallelization. Default is 1.
- Return type:
None
- evaluate_no_parall(ffunction, y, operator='sum')[source]
Evaluate the population using a fitness function (without parallelization). This function is not currently in use, but has been retained for potential future use at the developer’s discretion.
- Parameters:
ffunction (Callable) – Fitness function to evaluate the individuals.
y (torch.Tensor) – Expected output (target) values.
operator (str, optional) – Operator to apply to the semantics. Default is “sum”.
- Return type:
None