Exemplo n.º 1
0
        public async void GetIterationPerformance()
        {
            using (MockContext context = MockContext.Start(this.GetType()))
            {
                HttpMockServer.Initialize(this.GetType(), "GetIterationPerformance", RecorderMode);

                using (var project = CreateTrainedImageClassificationProject())
                {
                    ICustomVisionTrainingClient client = BaseTests.GetTrainingClient();

                    var iterations = await client.GetIterationsAsync(project.ProjectId);

                    Assert.True(iterations.Count > 0);

                    var iterationPerf = await client.GetIterationPerformanceAsync(project.ProjectId, iterations[iterations.Count - 1].Id, 0.9);

                    Assert.Equal(1, iterationPerf.Recall);
                    Assert.Equal(0, iterationPerf.RecallStdDeviation);
                    Assert.Equal(1, iterationPerf.Precision);
                    Assert.Equal(0, iterationPerf.PrecisionStdDeviation);
                    Assert.Equal(2, iterationPerf.PerTagPerformance.Count);
                    Assert.Equal("Tag1", iterationPerf.PerTagPerformance[0].Name);
                    Assert.Equal(1, iterationPerf.PerTagPerformance[0].Recall);
                    Assert.Equal(0, iterationPerf.PerTagPerformance[0].RecallStdDeviation);
                    Assert.Equal(1, iterationPerf.PerTagPerformance[0].Precision);
                    Assert.Equal(0, iterationPerf.PerTagPerformance[0].PrecisionStdDeviation);
                    Assert.Equal("Tag2", iterationPerf.PerTagPerformance[1].Name);
                    Assert.Equal(1, iterationPerf.PerTagPerformance[1].Recall);
                    Assert.Equal(0, iterationPerf.PerTagPerformance[1].RecallStdDeviation);
                    Assert.Equal(1, iterationPerf.PerTagPerformance[1].Precision);
                    Assert.Equal(0, iterationPerf.PerTagPerformance[1].PrecisionStdDeviation);
                }
            }
        }