CEM#
- class CEM(verbose=False, disable_tqdm=True, epochs=5, samples_per_epoch=100, elite_frac=0.1, processes=1)[source]#
Implementation of the Cross Entropy Method for hyperparameter tuning
The Cross Entropy Method is a stochastic optimization algorithm that iteratively samples candidate solutions from a multivariate normal distribution. The mean and covariance of the distribution are updated based on the best samples from the previous iteration. This alogrithm requries the following parameters to be set: - min and max bounds for each parameter - init initial values for each parameter
- verbose#
Whether to print the optimization progress.
- Type:
bool, default False
- disable_tqdm#
Whether to disable the tqdm progress bar.
- Type:
bool, default True
- epochs#
The number of epochs.
- Type:
int, default 5
- samples_per_epoch#
The number of samples per epoch.
- Type:
int, default 100
- elite_frac#
The fraction of elite samples that will be used to update the mean and covariance for next epoch.
- Type:
float, default 0.1
- processes#
The number of processes to use for parallel computation.
- Type:
int, default 1
- n_elite#
The number of elite samples. Calculated as samples_per_epoch * elite_frac.
- Type:
int
- minimize(func, init)[source]#
Method that minimizes the given function using the implemented optimization algorithm. This method has to be implemented by the subclass.
- Parameters:
func (Callable[[list[float]], OptimizationResult]) – The objective function to be minimized.
init (OptimizationParameter) – The initial parameter for the optimization algorithm. The required fields are defined by subclass.
- Returns:
Result contains the minimum function value, the corresponding optimal point, and the history of the optimization.
- Return type: