示例#1
0
        public async stt::Task GetModelEvaluationRequestObjectAsync()
        {
            moq::Mock <AutoMl.AutoMlClient> mockGrpcClient = new moq::Mock <AutoMl.AutoMlClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetModelEvaluationRequest request = new GetModelEvaluationRequest
            {
                Name = "name1c9368b0",
            };
            ModelEvaluation expectedResponse = new ModelEvaluation
            {
                Name                                  = "name1c9368b0",
                AnnotationSpecId                      = "annotation_spec_ide0c3e8b2",
                CreateTime                            = new wkt::Timestamp(),
                EvaluatedExampleCount                 = -1119926106,
                ClassificationEvaluationMetrics       = new ClassificationEvaluationMetrics(),
                TranslationEvaluationMetrics          = new TranslationEvaluationMetrics(),
                TextSentimentEvaluationMetrics        = new TextSentimentEvaluationMetrics(),
                ImageObjectDetectionEvaluationMetrics = new ImageObjectDetectionEvaluationMetrics(),
                TextExtractionEvaluationMetrics       = new TextExtractionEvaluationMetrics(),
                DisplayName                           = "display_name137f65c2",
            };

            mockGrpcClient.Setup(x => x.GetModelEvaluationAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <ModelEvaluation>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            AutoMlClient    client = new AutoMlClientImpl(mockGrpcClient.Object, null);
            ModelEvaluation responseCallSettings = await client.GetModelEvaluationAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            ModelEvaluation responseCancellationToken = await client.GetModelEvaluationAsync(request, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public async Task GetModelEvaluationAsync2()
        {
            Mock <AutoMl.AutoMlClient> mockGrpcClient = new Mock <AutoMl.AutoMlClient>(MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient())
            .Returns(new Mock <Operations.OperationsClient>().Object);
            GetModelEvaluationRequest request = new GetModelEvaluationRequest
            {
                ModelEvaluationName = new ModelEvaluationName("[PROJECT]", "[LOCATION]", "[MODEL]", "[MODEL_EVALUATION]"),
            };
            ModelEvaluation expectedResponse = new ModelEvaluation
            {
                Name                  = "name2-1052831874",
                AnnotationSpecId      = "annotationSpecId60690191",
                DisplayName           = "displayName1615086568",
                EvaluatedExampleCount = 277565350,
            };

            mockGrpcClient.Setup(x => x.GetModelEvaluationAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <ModelEvaluation>(Task.FromResult(expectedResponse), null, null, null, null));
            AutoMlClient    client   = new AutoMlClientImpl(mockGrpcClient.Object, null);
            ModelEvaluation response = await client.GetModelEvaluationAsync(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
示例#3
0
        public void GetModelEvaluationRequestObject()
        {
            moq::Mock <AutoMl.AutoMlClient> mockGrpcClient = new moq::Mock <AutoMl.AutoMlClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetModelEvaluationRequest request = new GetModelEvaluationRequest
            {
                Name = "name1c9368b0",
            };
            ModelEvaluation expectedResponse = new ModelEvaluation
            {
                Name                                  = "name1c9368b0",
                AnnotationSpecId                      = "annotation_spec_ide0c3e8b2",
                CreateTime                            = new wkt::Timestamp(),
                EvaluatedExampleCount                 = -1119926106,
                ClassificationEvaluationMetrics       = new ClassificationEvaluationMetrics(),
                TranslationEvaluationMetrics          = new TranslationEvaluationMetrics(),
                TextSentimentEvaluationMetrics        = new TextSentimentEvaluationMetrics(),
                ImageObjectDetectionEvaluationMetrics = new ImageObjectDetectionEvaluationMetrics(),
                TextExtractionEvaluationMetrics       = new TextExtractionEvaluationMetrics(),
                DisplayName                           = "display_name137f65c2",
            };

            mockGrpcClient.Setup(x => x.GetModelEvaluation(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            AutoMlClient    client   = new AutoMlClientImpl(mockGrpcClient.Object, null);
            ModelEvaluation response = client.GetModelEvaluation(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void GetModelEvaluation2()
        {
            Mock <AutoMl.AutoMlClient> mockGrpcClient = new Mock <AutoMl.AutoMlClient>(MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient())
            .Returns(new Mock <Operations.OperationsClient>().Object);
            GetModelEvaluationRequest request = new GetModelEvaluationRequest
            {
                ModelEvaluationName = new ModelEvaluationName("[PROJECT]", "[LOCATION]", "[MODEL]", "[MODEL_EVALUATION]"),
            };
            ModelEvaluation expectedResponse = new ModelEvaluation
            {
                Name                  = "name2-1052831874",
                AnnotationSpecId      = "annotationSpecId60690191",
                EvaluatedExampleCount = 277565350,
            };

            mockGrpcClient.Setup(x => x.GetModelEvaluation(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            AutoMlClient    client   = new AutoMlClientImpl(mockGrpcClient.Object, null);
            ModelEvaluation response = client.GetModelEvaluation(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
 /// <summary>Snippet for GetModelEvaluation</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetModelEvaluation()
 {
     // Create client
     AutoMlClient autoMlClient = AutoMlClient.Create();
     // Initialize request argument(s)
     string name = "projects/[PROJECT]/locations/[LOCATION]/models/[MODEL]/modelEvaluations/[MODEL_EVALUATION]";
     // Make the request
     ModelEvaluation response = autoMlClient.GetModelEvaluation(name);
 }
 /// <summary>Snippet for GetModelEvaluation</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetModelEvaluationResourceNames()
 {
     // Create client
     AutoMlClient autoMlClient = AutoMlClient.Create();
     // Initialize request argument(s)
     ModelEvaluationName name = ModelEvaluationName.FromProjectLocationModelModelEvaluation("[PROJECT]", "[LOCATION]", "[MODEL]", "[MODEL_EVALUATION]");
     // Make the request
     ModelEvaluation response = autoMlClient.GetModelEvaluation(name);
 }
示例#7
0
 /// <summary>Snippet for GetModelEvaluation</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetModelEvaluationRequestObject()
 {
     // Create client
     AutoMlClient autoMlClient = AutoMlClient.Create();
     // Initialize request argument(s)
     GetModelEvaluationRequest request = new GetModelEvaluationRequest
     {
         ModelEvaluationName = ModelEvaluationName.FromProjectLocationModelModelEvaluation("[PROJECT]", "[LOCATION]", "[MODEL]", "[MODEL_EVALUATION]"),
     };
     // Make the request
     ModelEvaluation response = autoMlClient.GetModelEvaluation(request);
 }
示例#8
0
 /// <summary>Snippet for GetModelEvaluation</summary>
 public void GetModelEvaluationRequestObject()
 {
     // Snippet: GetModelEvaluation(GetModelEvaluationRequest, CallSettings)
     // Create client
     AutoMlClient autoMlClient = AutoMlClient.Create();
     // Initialize request argument(s)
     GetModelEvaluationRequest request = new GetModelEvaluationRequest {
         Name = "",
     };
     // Make the request
     ModelEvaluation response = autoMlClient.GetModelEvaluation(request);
     // End snippet
 }
示例#9
0
        /// <summary>Snippet for GetModelEvaluationAsync</summary>
        public async Task GetModelEvaluationRequestObjectAsync()
        {
            // Snippet: GetModelEvaluationAsync(GetModelEvaluationRequest, CallSettings)
            // Additional: GetModelEvaluationAsync(GetModelEvaluationRequest, CancellationToken)
            // Create client
            AutoMlClient autoMlClient = await AutoMlClient.CreateAsync();

            // Initialize request argument(s)
            GetModelEvaluationRequest request = new GetModelEvaluationRequest {
                Name = "",
            };
            // Make the request
            ModelEvaluation response = await autoMlClient.GetModelEvaluationAsync(request);

            // End snippet
        }
示例#10
0
        public void PrepareGraphs(ModelEvaluation modelEval)
        {
            //clear prev. state
            trainingGraph.GraphPane.CurveList.Clear();
            validationGraph.GraphPane.CurveList.Clear();

            //prepare series
            prepareSeriesGraph(modelEval, trainingGraph, ref actualTraining, ref predictedTraining);
            prepareSeriesGraph(modelEval, validationGraph, ref actualValidation, ref predictedValidation);

            //add series after initialization
            trainingGraph.GraphPane.CurveList.Add(actualTraining);
            trainingGraph.GraphPane.CurveList.Add(predictedTraining);
            validationGraph.GraphPane.CurveList.Add(actualValidation);
            validationGraph.GraphPane.CurveList.Add(predictedValidation);
        }
示例#11
0
        private void prepareSeriesGraph(ModelEvaluation modelEval, ZedChartExt zedGraph, ref LineItem actualSeries, ref LineItem predictedSeries)
        {
            zedGraph.SetFont();


            //
            if (modelEval.ModelOutputDim == 1)
            {
                predictedSeries             = new LineItem("Predicted", null, null, System.Drawing.Color.Blue, ZedGraph.SymbolType.None, 1);
                predictedSeries.Symbol.Fill = new Fill(System.Drawing.Color.Blue);
                predictedSeries.Symbol.Size = 1;
                //
                actualSeries             = new LineItem("Actual", null, null, System.Drawing.Color.Orange, ZedGraph.SymbolType.None, 1);
                actualSeries.Symbol.Fill = new Fill(System.Drawing.Color.Orange);
                actualSeries.Symbol.Size = 1;

                zedGraph.GraphPane.YAxis.Scale.MaxAuto = true;
                zedGraph.GraphPane.YAxis.Scale.MinAuto = true;

                zedGraph.GraphPane.YAxis.MajorGrid.IsVisible = false;
                zedGraph.GraphPane.XAxis.MajorGrid.IsVisible = false;

                zedGraph.GraphPane.YAxis.Scale.MajorStepAuto = true;
                zedGraph.GraphPane.YAxis.Scale.MinorStepAuto = true;

                zedGraph.GraphPane.XAxis.Scale.MajorStep = 1;
                zedGraph.GraphPane.XAxis.Scale.MinorStep = 0;
            }
            else
            {
                Classes = modelEval.Classes;
                if (modelEval.Classes == null || modelEval.Classes.Count == 0)
                {
                    max = 0;
                }
                else
                {
                    max = modelEval.Classes.Count - 1;
                }

                predictedSeries             = new LineItem("Predicted", null, null, System.Drawing.Color.Orange, ZedGraph.SymbolType.Circle, 0);
                predictedSeries.Symbol.Fill = new Fill(System.Drawing.Color.Orange);
                predictedSeries.Symbol.Size = 5;


                actualSeries = new LineItem("Actual", null, null, System.Drawing.Color.Blue, ZedGraph.SymbolType.Diamond, 0);
                actualSeries.Symbol.Border = new ZedGraph.Border(System.Drawing.Color.Blue, 0.5f);
                actualSeries.Symbol.Fill   = new Fill(System.Drawing.Color.Blue);
                actualSeries.Symbol.Size   = 4;

                zedGraph.GraphPane.YAxis.ScaleFormatEvent += YAxis_ScaleFormatEvent;

                //zedModel.GraphPane.XAxis.Scale.Min = 0;
                zedGraph.GraphPane.YAxis.Scale.Min           = -0.1;
                zedGraph.GraphPane.YAxis.Scale.Max           = max + 0.2;
                zedGraph.GraphPane.YAxis.MajorGrid.DashOff   = 0;
                zedGraph.GraphPane.YAxis.MajorGrid.IsVisible = true;
                zedGraph.GraphPane.XAxis.MajorGrid.DashOff   = 0;
                zedGraph.GraphPane.XAxis.MajorGrid.IsVisible = false;
                zedGraph.GraphPane.YAxis.Scale.MajorStep     = 1;
                zedGraph.GraphPane.YAxis.Scale.MinorStep     = 1;
                zedGraph.GraphPane.XAxis.Scale.MajorStep     = 1;
                zedGraph.GraphPane.XAxis.Scale.MinorStep     = 1;
            }
        }