bnelearn.sampler.samplers_correlated_pv module¶
This module implements samplers for correlated private values settings.
- class bnelearn.sampler.samplers_correlated_pv.BernoulliWeightsCorrelatedSymmetricUniformPVSampler(n_players: int, valuation_size: int, correlation: float, u_lo: float = 0.0, u_hi: float = 1.0, default_batch_size=1, default_device: Optional[Union[device, str, int]] = None)[source]¶
Bases:
CorrelatedSymmetricUniformPVSampler
- draw_conditional_profiles(conditioned_player: int, conditioned_observation: Tensor, inner_batch_size: int, device: Optional[Union[device, str, int]] = None) → Tuple[Tensor, Tensor][source]¶
Draws and returns batches conditional valuation and corresponding observation profile. For each entry of conditioned_observation, batch_size samples will be drawn!
Note that here, we are returning full profiles instead (including conditioned_player’s observation and others’ valuations.)
- Args:
- conditioned_player: int
Index of the player whose observation we are conditioning on.
- conditioned_observation: torch.Tensor (*outer_batch_sizes (implicit), observation_size)
A (batch of) observations of player conditioned_player.
- Kwargs:
batch_size (optional): int, the “inner”batch_size to draw - i.e. how many conditional samples to draw for each provided conditional_observation. If none provided, will use self.default_batch_size of the class.
- Returns:
- valuations: torch.Tensor (outer_batch_size, inner_batch_size, n_players, valuation_size):
a conditional valuation profile
- observations: torch.Tensor (*`outer_batch_size`s, inner_batch_size, n_players, observation_size):
a corresponding conditional observation profile. observations[:,conditioned_observation,:] will be equal to conditioned_observation repeated batch_size times
- class bnelearn.sampler.samplers_correlated_pv.ConstantWeightCorrelatedSymmetricUniformPVSampler(n_players: int, valuation_size: int, correlation: float, u_lo: float = 0.0, u_hi: float = 1.0, default_batch_size=1, default_device: Optional[Union[device, str, int]] = None)[source]¶
Bases:
CorrelatedSymmetricUniformPVSampler
- draw_conditional_profiles(conditioned_player: int, conditioned_observation: Tensor, inner_batch_size: int, device: Optional[Union[device, str, int]] = None) → Tuple[Tensor, Tensor][source]¶
Draws and returns batches conditional valuation and corresponding observation profile. For each entry of conditioned_observation, batch_size samples will be drawn!
Note that here, we are returning full profiles instead (including conditioned_player’s observation and others’ valuations.)
- Args:
- conditioned_player: int
Index of the player whose observation we are conditioning on.
- conditioned_observation: torch.Tensor (*outer_batch_sizes (implicit), observation_size)
A (batch of) observations of player conditioned_player.
- Kwargs:
batch_size (optional): int, the “inner”batch_size to draw - i.e. how many conditional samples to draw for each provided conditional_observation. If none provided, will use self.default_batch_size of the class.
- Returns:
- valuations: torch.Tensor (outer_batch_size, inner_batch_size, n_players, valuation_size):
a conditional valuation profile
- observations: torch.Tensor (*`outer_batch_size`s, inner_batch_size, n_players, observation_size):
a corresponding conditional observation profile. observations[:,conditioned_observation,:] will be equal to conditioned_observation repeated batch_size times
- class bnelearn.sampler.samplers_correlated_pv.CorrelatedSymmetricUniformPVSampler(u_lo: float, u_hi: float, n_players: int, valuation_size: int, correlation: float, weight_method, default_batch_size=1, default_device: Optional[Union[device, str, int]] = None)[source]¶
Bases:
PVSampler
,ABC
Draws (non-independent) symmetric uniform valuation profiles that are pairwise correlated between the bidders according to the models from Ausubel & Baranov (2019) (https://doi.org/10.1007/s00182-019-00691-3).
Use subclasses BernoulliWeightsCorrelatedSymmetricUniformPVSampler or ConstantWeightsCorrelatedSymmetricUniformPVSampler to initialize.
Individual valuations v_i are composed additively of an individual component \(z_i\) and a common component \(s\), where \(z_i, s\) are each uniform.
\[v_i = (1-w) z_i + w s\]weights are set according to either the ‘Bernoulli Weights Model’ or ‘Constant Weights Model’.
In this scheme, a Bernoulli (0 or 1) weight determines that either \(v_i = z_i\) or \(v_i = s\), with weights/probabilities being set such that correlation \(\gamma\) is achieved between bidders.
- class bnelearn.sampler.samplers_correlated_pv.LLGFullSampler(correlation=0.0, correlation_method=None, default_batch_size=1, default_device=None)[source]¶
Bases:
LLGSampler
A sampler for the LLG full setting.
- generate_action_grid(player_position: int, minimum_number_of_points: int, dtype=torch.float32, device=None, support_bounds=None) → Tensor[source]¶
Here, the grid needs to be three dimensional and the support bounds need to be wider.
- class bnelearn.sampler.samplers_correlated_pv.LLGSampler(correlation=0.0, correlation_method=None, default_batch_size=1, default_device=None)[source]¶
Bases:
LocalGlobalCompositePVSampler
A sampler for the LLG settings in Ausubel & Baranov.
- Args:
- correlation (float), correlation coefficient between local bidders,
takes values in [0.0, 1.0]
- correlation_method (str or None, default: None): The type of correlation
model. For correlation > 0.0, must be one of ‘Bernoulli’ or ‘constant’
- class bnelearn.sampler.samplers_correlated_pv.LLLLGGSampler(correlation_locals=0.0, correlation_method_locals=None, default_batch_size=1, default_device=None)[source]¶
Bases:
LocalGlobalCompositePVSampler
A sampler for the LLLLGG settings in Bosshard et al (2020).
- Note: while the auction is for 6 players and 8 items, our auction implementation uses symmetries and
encodes each player’s valuations with a valuation_size of 2.
- Args:
- correlation_locals (float), correlation coefficient between local bidders,
takes values in [0.0, 1.0]
- correlation_method_locals (str or None, default: None): The type of correlation
model. For correlation > 0.0, must be one of ‘Bernoulli’ or ‘constant’
- class bnelearn.sampler.samplers_correlated_pv.LLLLRRGSampler(correlation_locals=0.0, correlation_method_locals=None, correlation_regionals=0.0, correlation_method_regionals=None, default_batch_size=1, default_device=None)[source]¶
Bases:
CompositeValuationObservationSampler
Setting with three groups of players: The local players (L’s) have symmetric (possibly correlated) uniform valuations on [0,1]. The regional (R) bidders have symmetric (possibly correlated) uniform valuations on [0,2]. The global (G) bidder has a valuation
- class bnelearn.sampler.samplers_correlated_pv.LocalGlobalCompositePVSampler(n_locals: int, n_globals: int, valuation_size: int, correlation_locals=0.0, correlation_method_locals=None, correlation_globals=0.0, correlation_method_globals=None, default_batch_size=1, default_device=None)[source]¶
Bases:
CompositeValuationObservationSampler
Settings with two groups of players: The local players have symmetric (possibly correlated) uniform valuations on [0,1]. The global bidders have symmetric (possibly correlated) uniform valuations on [0,2].