bnelearn.sampler.samplers_non_pv module¶
This module implements samplers that do not adhere to the private values setting.
- class bnelearn.sampler.samplers_non_pv.AffiliatedValuationObservationSampler(n_players: int, valuation_size: int = 1, u_lo: float = 0.0, u_hi: float = 1.0, default_batch_size: int = 1, default_device=None)[source]¶
Bases:
ValuationObservationSamplerThe ‘Affiliated Values Model’ model. (Krishna 2009, Example 6.2). This is a private values model.
Two bidders have signals
\[\]o_i = z_i + s
and valuations .. math:: v_i = s + (z_1+z_2)/2 = mean_i(o_i)
where z_i and s are i.i.d. standard uniform.
- 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
- draw_profiles(batch_sizes: Optional[List[int]] = None, device=None) Tuple[Tensor, Tensor][source]¶
Draws and returns a batch of valuation and observation profiles.
- Kwargs:
batch_sizes (optional): List[int], the batch_sizes to draw. If none provided, [self.default_batch_size] will be used. device (optional): torch.cuda.Device, the device to draw profiles on
- Returns:
valuations: torch.Tensor (*batch_sizes x n_players x valuation_size): a valuation profile observations: torch.Tensor (*batch_sizes x n_players x observation_size): an observation profile
- class bnelearn.sampler.samplers_non_pv.MineralRightsValuationObservationSampler(n_players: int, valuation_size: int = 1, common_value_lo: float = 0.0, common_value_hi: float = 1.0, default_batch_size: int = 1, default_device=None)[source]¶
Bases:
ValuationObservationSamplerThe ‘Mineral Rights’ model is a common value model: There is a uniformly distributed common value of the item(s), each agent’s observation is then uniformly drawn from U[0,2v]. See Kishna (2009), Example 6.1
- 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
- draw_profiles(batch_sizes: Optional[List[int]] = None, device=None) Tuple[Tensor, Tensor][source]¶
Draws and returns a batch of valuation and observation profiles.
- Kwargs:
batch_sizes (optional): List[int], the batch_sizes to draw. If none provided, [self.default_batch_size] will be used. device (optional): torch.cuda.Device, the device to draw profiles on
- Returns:
valuations: torch.Tensor (*batch_sizes x n_players x valuation_size): a valuation profile observations: torch.Tensor (*batch_sizes x n_players x observation_size): an observation profile