PoliciesMultiPlayers.OracleNotFair module

OracleNotFair: a multi-player policy with full knowledge and centralized intelligence to affect users to a FIXED arm, among the best arms.

  • It allows to have absolutely no collision, if there is more channels than users (always assumed).

  • But it is NOT fair on ONE run: the best arm is played only by one player.

  • Note that in average, it is fair (who plays the best arm is randomly decided).

  • Note that it IS affecting players on the best arms: it requires full knowledge of the means of the arms, not simply the number of arms.

  • Note that they need a perfect knowledge on the arms, even this is not physically plausible.

class PoliciesMultiPlayers.OracleNotFair.Fixed(nbArms, armIndex)[source]

Bases: PoliciesMultiPlayers.BaseCentralizedPolicy.BaseCentralizedPolicy

Fixed: always select a fixed arm, as decided by the OracleNotFair multi-player policy.

__init__(nbArms, armIndex)[source]

Fixed on this arm.

nbArms = None

Number of arms

armIndex = None

Index of fixed arm

__str__()[source]

Return str(self).

startGame()[source]

Nothing to do.

getReward(arm, reward)[source]

Nothing to do.

choice()[source]

Chose fixed arm.

__module__ = 'PoliciesMultiPlayers.OracleNotFair'
class PoliciesMultiPlayers.OracleNotFair.OracleNotFair(nbPlayers, armsMAB, lower=0.0, amplitude=1.0)[source]

Bases: PoliciesMultiPlayers.BaseMPPolicy.BaseMPPolicy

OracleNotFair: a multi-player policy which uses a centralized intelligence to affect users to affect users to a FIXED arm, among the best arms.

__init__(nbPlayers, armsMAB, lower=0.0, amplitude=1.0)[source]
  • nbPlayers: number of players to create (in self._players).

  • armsMAB: MAB object that represents the arms.

Examples:

>>> import sys; sys.path.insert(0, '..'); from Environment import MAB; from Arms import Bernoulli
>>> import random; random.seed(0); import numpy as np; np.random.seed(0)
>>> problem = MAB({'arm_type': Bernoulli, 'params': [0.1, 0.5, 0.9]})  
...
>>> s = OracleNotFair(2, problem)
>>> [ child.choice() for child in s.children ]
[2, 1]
>>> [ child.choice() for child in s.children ]
[2, 1]
  • To get a list of usable players, use s.children.

  • Warning: s._players is for internal use

nbPlayers = None

Number of players

nbArms = None

Number of arms

children = None

List of children, fake algorithms

__str__()[source]

Return str(self).

__module__ = 'PoliciesMultiPlayers.OracleNotFair'
_printNbCollisions()[source]

Print number of collisions.