MemeticOptimizer#

class empulse.optimizers.MemeticOptimizer(bounds=(-10.0, 10.0), population_size=50, max_iter=100, patience=20, tol=1e-06, crossover_rate=0.8, mutation_rate=0.1, elitism=0.05, local_steps=5, lr=0.05, optimizer='adam', beta1=0.9, beta2=0.999, eps=1e-08, grad_clip=5.0, random_state=42)[source]#

Real-coded Lamarckian Memetic Algorithm optimizer for logit models.

Combines a real-coded genetic algorithm (population-level diversity) with a gradient local search applied Lamarckian-style to every individual before its fitness is evaluated. The gradient-refined weights overwrite the original genome so evolution always acts on already-locally-optimised solutions.

The per-individual local search reuses the ROC convex hull across all local_steps gradient evaluations (see LamarckianGeneration). Final fitness is always evaluated on a fresh hull via score.

Parameters:
boundstuple of (float, float), default=(-10.0, 10.0)

Symmetric lower and upper bounds applied to every coefficient.

population_sizeint, default=50

Number of individuals in the population.

max_iterint, default=100

Maximum number of GA generations.

patienceint, default=20

Stop early when the best fitness has not improved by more than tol over the last patience generations.

tolfloat, default=1e-6

Convergence tolerance for the patience criterion.

crossover_ratefloat, default=0.8

Crossover probability (passed to LamarckianGeneration).

mutation_ratefloat, default=0.1

Mutation probability (passed to LamarckianGeneration).

elitismfloat, default=0.05

Elite fraction (passed to LamarckianGeneration).

local_stepsint, default=5

Number of gradient steps per individual per generation.

lrfloat, default=0.05

Learning rate for the local search.

optimizer{“adam”, “sgd”}, default=”adam”

Local-search update rule passed to LamarckianGeneration.

beta1float, default=0.9
beta2float, default=0.999
epsfloat, default=1e-8
grad_clipfloat, default=5.0

Adam / gradient-clipping hyper-parameters.

random_stateint, default=42

Seed for the GA random-number generator.

__call__(objective, X, **_)[source]#

Run the Lamarckian GA with the given objective function.