private async Task GetProperties(PersonalizerAdministrationClient client, PersonalizerServiceProperties properties)
        {
            PersonalizerServiceProperties result = await client.GetPersonalizerPropertiesAsync();

            Assert.AreEqual(properties.DefaultReward, result.DefaultReward);
            Assert.True(Math.Abs(properties.ExplorationPercentage - result.ExplorationPercentage) < 1e-3);
            Assert.AreEqual(properties.ModelExportFrequency, result.ModelExportFrequency);
            Assert.AreEqual(properties.RewardAggregation, result.RewardAggregation);
            Assert.AreEqual(properties.RewardWaitTime, result.RewardWaitTime);
        }
Exemple #2
0
        public async Task GetServiceConfiguration()
        {
            PersonalizerAdministrationClient client        = GetPersonalizerAdministrationClient();
            PersonalizerServiceProperties    defaultConfig = await client.GetPersonalizerPropertiesAsync();

            Assert.AreEqual(TimeSpan.FromMinutes(1), defaultConfig.RewardWaitTime);
            Assert.AreEqual(TimeSpan.FromHours(1), defaultConfig.ModelExportFrequency);
            Assert.AreEqual(1, defaultConfig.DefaultReward);
            Assert.AreEqual(0.2, defaultConfig.ExplorationPercentage, 0.00000001);
            Assert.AreEqual(0, defaultConfig.LogRetentionDays);
        }
        private async Task UpdateProperties(PersonalizerAdministrationClient client, PersonalizerServiceProperties properties)
        {
            PersonalizerServiceProperties result = await client.UpdatePersonalizerPropertiesAsync(properties);

            Assert.AreEqual(properties.DefaultReward, result.DefaultReward);
            Assert.True(Math.Abs(properties.ExplorationPercentage - result.ExplorationPercentage) < 1e-3);
            Assert.AreEqual(properties.ModelExportFrequency, result.ModelExportFrequency);
            Assert.AreEqual(properties.RewardAggregation, result.RewardAggregation);
            Assert.AreEqual(properties.RewardWaitTime, result.RewardWaitTime);
            if (Environment.GetEnvironmentVariable("AZURE_TEST_MODE") == "Record")
            {
                await Task.Delay(60000);
            }
        }
Exemple #4
0
        private async Task EnableMultiSlot(PersonalizerAdministrationClient adminClient)
        {
            PersonalizerServiceProperties properties = await adminClient.GetPersonalizerPropertiesAsync();

            properties.IsAutoOptimizationEnabled = false;
            await adminClient.UpdatePersonalizerPropertiesAsync(properties);

            await Task.Delay(30000);

            await adminClient.UpdatePersonalizerPolicyAsync(new PersonalizerPolicy("multiSlot", "--ccb_explore_adf --epsilon 0.2 --power_t 0 -l 0.001 --cb_type mtr -q ::"));

            //sleep 30 seconds to allow settings to propagate
            await Task.Delay(30000);
        }
        public async Task ConfigurationTests()
        {
            TimeSpan newExperimentalUnitDuration = TimeSpan.FromSeconds(7);
            TimeSpan modelExportFrequency        = TimeSpan.FromMinutes(3);
            double   newDefaultReward            = 1.0;
            string   newRewardFuntion            = "average";
            float    newExplorationPercentage    = 0.2f;
            var      properties = new PersonalizerServiceProperties(
                rewardAggregation: newRewardFuntion,
                modelExportFrequency: modelExportFrequency,
                defaultReward: (float)newDefaultReward,
                rewardWaitTime: newExperimentalUnitDuration,
                explorationPercentage: newExplorationPercentage,
                logRetentionDays: int.MaxValue
                );
            PersonalizerAdministrationClient client = GetAdministrationClient(isSingleSlot: true);

            await UpdateProperties(client, properties);
            await GetProperties(client, properties);
            await UpdateAndGetPolicy(client);
            await ResetPolicy(client);
        }
Exemple #6
0
        public async Task UpdateServiceConfiguration()
        {
            PersonalizerAdministrationClient client = GetPersonalizerAdministrationClient();
            TimeSpan newExperimentalUnitDuration    = TimeSpan.FromMinutes(1);
            TimeSpan modelExportFrequency           = TimeSpan.FromHours(1);
            double   newDefaultReward         = 1.0;
            string   newRewardFuntion         = "average";
            double   newExplorationPercentage = 0.2f;
            var      config = new PersonalizerServiceProperties(
                rewardAggregation: newRewardFuntion,
                modelExportFrequency: modelExportFrequency,
                defaultReward: (float)newDefaultReward,
                rewardWaitTime: newExperimentalUnitDuration,
                explorationPercentage: (float)newExplorationPercentage,
                logRetentionDays: int.MaxValue
                );
            PersonalizerServiceProperties result = await client.UpdatePersonalizerConfigurationAsync(config);

            Assert.AreEqual(config.DefaultReward, result.DefaultReward);
            Assert.True(Math.Abs(config.ExplorationPercentage - result.ExplorationPercentage) < 1e-3);
            Assert.AreEqual(config.ModelExportFrequency, result.ModelExportFrequency);
            Assert.AreEqual(config.RewardAggregation, result.RewardAggregation);
            Assert.AreEqual(config.RewardWaitTime, result.RewardWaitTime);
        }