MWU-Max Module

Implements a MWU-max method.

The MWU implemented here tries to maximize a cost function (gains function, in this case). This is done by alocating probabilities in the available dimensions, with the constraint that the sum of allocated probabilities is <= 1.

class mwu_max.MwuMax(n_experts: int, eps: float)[source]

Class that implements MWU-max algorithm.

Parameters
n_expertsint

Dimension of the problem cost function.

epsfloat

Calibration parameter that regulates the step-size of the updates.

Notes

Usually, the mwu respects the following restriction: \(\sum_{i=1}^d p_i = 1\), where \(p_i\) is the probability or weight attributed to dimnesion \(i\). In order to accomodate the restriction that \(\sum_{i=1}^d p_i \leq 1\), we consider an extra dimension, which always receives cost 0.

Methods

update_weights(expert_gains: List[float])

Update mwu probabilities based on a new input of the cost function.

get_probs()

Get a copy of the currently allocated probabilities.

get_n_experts()

Get the number of dimensions used in this instance.

get_n_experts()int[source]

Getter for the number of dimensions (experts) in this instance.

Returns
int

The number of experts.

get_probs()List[float][source]

Getter for the current probabilities.

Returns
list of float

Current probabilies of each dimension.

update_weights(expert_gains: List[float])List[float][source]

Update mwu probailitiesbased on a new input of the cost function.

Parameters
expert_gainslist of float

A list containing the new input from the cost function. Length must match instance dimension.

Returns
list of float

Updated probabilies of each dimension.