Exemple #1
0
    testing_iterations = 500
    NoiseScale = 0.1  # standard deviation of Gaussian noise
    n_articles = 25
    n_users = 10
    poolArticleSize = None

    if actionset == "basis_vector":
        n_articles = context_dimension  # there can be at most context_dimension number of basis vectors

    ## Set Up Simulation ##
    UM = UserManager(context_dimension,
                     n_users,
                     thetaFunc=gaussianFeature,
                     argv={'l2_limit': 1})
    users = UM.simulateThetafromUsers()
    AM = ArticleManager(context_dimension,
                        n_articles=n_articles,
                        argv={'l2_limit': 1})
    articles = AM.simulateArticlePool(actionset)

    simExperiment = simulateOnlineData(
        context_dimension=context_dimension,
        testing_iterations=testing_iterations,
        plot=True,
        articles=articles,
        users=users,
        noise=lambda: np.random.normal(scale=NoiseScale),
        signature=AM.signature,
        NoiseScale=NoiseScale,
        poolArticleSize=poolArticleSize)
Exemple #2
0
    config["dLinUCB_alpha"] = 0.6
    #CoDBand
    config["memory_size"] = 70

    # Generate user and item vectors
    userFilename = os.path.join(
        sim_files_folder, "users_" + str(config["n_users"]) + "context_" +
        str(config["context_dimension"]) + "Ugroups" +
        str(config["UserGroups"]) + ".json")
    UM = UserManager(config["context_dimension"],
                     config["n_users"],
                     config["gamma"],
                     UserGroups=config["UserGroups"],
                     thetaFunc=gaussianFeature,
                     argv={'l2_limit': 1})
    users, global_parameter_set, parameter_index_for_users = UM.simulateThetafromUsers(
    )

    articlesFilename = os.path.join(
        sim_files_folder, "articles_" + str(config["n_articles"]) +
        "context_" + str(config["context_dimension"]) + "Agroups" +
        str(config["ArticleGroups"]) + ".json")
    AM = ArticleManager(config["context_dimension"],
                        n_articles=config["n_articles"],
                        ArticleGroups=config["ArticleGroups"],
                        FeatureFunc=gaussianFeature,
                        argv={'l2_limit': 1})
    articles = AM.simulateArticlePool()

    for i in range(len(articles)):
        articles[i].contextFeatureVector = articles[
            i].featureVector[:config["context_dimension"]]