ml.rl.simulators package

Submodules

ml.rl.simulators.recsim module

class ml.rl.simulators.recsim.DocumentFeature(topic, length, quality)

Bases: tuple

property length

Alias for field number 1

property quality

Alias for field number 2

property topic

Alias for field number 0

class ml.rl.simulators.recsim.RecSim(num_topics: int = 20, doc_length: float = 4, quality_means: List[Tuple[float, float]] = [(-3.0, 0.0), (-3.0, 0.0), (-3.0, 0.0), (-3.0, 0.0), (-3.0, 0.0), (-3.0, 0.0), (-3.0, 0.0), (-3.0, 0.0), (-3.0, 0.0), (-3.0, 0.0), (-3.0, 0.0), (-3.0, 0.0), (-3.0, 0.0), (-3.0, 0.0), (0.0, 3.0), (0.0, 3.0), (0.0, 3.0), (0.0, 3.0), (0.0, 3.0), (0.0, 3.0)], quality_variances: List[float] = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], initial_budget: float = 200, alpha: float = 1.0, m: int = 10, k: int = 3, num_users: int = 5000, y: float = 0.3, device: str = 'cpu', seed: int = 2147483647)

Bases: object

An environment described in Section 6 of https://arxiv.org/abs/1905.12767

bonus(u, d, length, quality)
compute_user_choice(slate)
interest(u, d)
Parameters
  • u – shape [batch, T]

  • d – shape [batch, k, T]

obs()

Agent can observe: - User interest vector - Document topic vector - Document length - Document quality

reset()
sample_documents(n: int) → ml.rl.simulators.recsim.DocumentFeature
sample_users(n)

User is represented by vector of topic interest, uniformly sampled from [-1, 1]

satisfactory(u, d, quality)
select(candidates, indices, add_null)
step(action: torch.Tensor) → int
update_active_users() → int
update_user_budget(selected_choice)
update_user_interest(selected_choice)

Module contents