Exemple #1
0
def create_multiclick_environment(env_config):
    """Creates an interest evolution environment."""
    def choice_model_ctor(*args, **kwargs):
        return choice_model.DependentClickModel(
            next_probs=[0.8**(i + 1) for i in range(env_config["slate_size"])],
            slate_size=env_config["slate_size"],
            score_scaling=1.0,
        )

    user_model = MulticlickIEvUserModel(
        env_config["slate_size"],
        choice_model_ctor=choice_model_ctor,
        response_model_ctor=interest_evolution.IEvResponse,
        user_state_ctor=UserState,
        seed=env_config["seed"],
    )

    document_sampler = interest_evolution.UtilityModelVideoSampler(
        doc_ctor=interest_evolution.IEvVideo, seed=env_config["seed"])

    ievenv = environment.Environment(
        user_model,
        document_sampler,
        env_config["num_candidates"],
        env_config["slate_size"],
        resample_documents=env_config["resample_documents"],
    )

    return recsim_gym.RecSimGymEnv(
        ievenv,
        interest_evolution.clicked_watchtime_reward,
        utils.aggregate_video_cluster_metrics,
        utils.write_video_cluster_metrics,
    )
def iev_document_sampler_creator(env_ctx):
    return iev.UtilityModelVideoSampler(doc_ctor=iev.IEvVideo,
                                        seed=env_ctx["seed"])