Mix root priors with a supplied Dirichlet noise sample. Priors and noise are nonnegative NumPy weight arrays, not necessarily normalized; legal_mask is a Boolean NumPy array. For each legal action a,
Pa′=(1−ε)Pa+εηa.Here Pa′ is the mixed prior, ε is epsilon, and P and η are priors and noise normalized separately over legal actions. Illegal actions receive exactly zero. Use the supplied noise without sampling new values. Return a new NumPy float64 array with the same shape and action order as priors.
Input: priors = [2,1,0], noise = [0,3,4], legal_mask = [true,true,false], epsilon = 0.25
Output: [0.5,0.5,0]
Explanation: Priors and noise are normalized over the first two actions before the 75 to 25 mixture.
Input: priors = [1,3,5], noise = [4,0,96], legal_mask = [true,true,false], epsilon = 1
Output: [1,0,0]
Input: priors = [10,0,2], noise = [7,8,5], legal_mask = [false,false,true], epsilon = 0.6
Output: [0,0,1]
Boolean indexing isolates the legal weights before summing.
np.zeros can hold the full action array while legal entries are filled.
Accepts: array
Accepts: array
Accepts: array
Accepts: number
Mix root priors with a supplied Dirichlet noise sample. Priors and noise are nonnegative NumPy weight arrays, not necessarily normalized; legal_mask is a Boolean NumPy array. For each legal action a,
Pa′=(1−ε)Pa+εηa.Here Pa′ is the mixed prior, ε is epsilon, and P and η are priors and noise normalized separately over legal actions. Illegal actions receive exactly zero. Use the supplied noise without sampling new values. Return a new NumPy float64 array with the same shape and action order as priors.
Input: priors = [2,1,0], noise = [0,3,4], legal_mask = [true,true,false], epsilon = 0.25
Output: [0.5,0.5,0]
Explanation: Priors and noise are normalized over the first two actions before the 75 to 25 mixture.
Input: priors = [1,3,5], noise = [4,0,96], legal_mask = [true,true,false], epsilon = 1
Output: [1,0,0]
Input: priors = [10,0,2], noise = [7,8,5], legal_mask = [false,false,true], epsilon = 0.6
Output: [0,0,1]
Boolean indexing isolates the legal weights before summing.
np.zeros can hold the full action array while legal entries are filled.
Accepts: array
Accepts: array
Accepts: array
Accepts: number