Exemple #1
0
        /// <summary>Snippet for BatchPredict</summary>
        public void BatchPredictRequestObject()
        {
            // Snippet: BatchPredict(BatchPredictRequest, CallSettings)
            // Create client
            PredictionServiceClient predictionServiceClient = PredictionServiceClient.Create();
            // Initialize request argument(s)
            BatchPredictRequest request = new BatchPredictRequest
            {
                ModelName    = ModelName.FromProjectLocationModel("[PROJECT]", "[LOCATION]", "[MODEL]"),
                InputConfig  = new BatchPredictInputConfig(),
                OutputConfig = new BatchPredictOutputConfig(),
                Params       = { { "", "" }, },
            };
            // Make the request
            Operation <BatchPredictResult, OperationMetadata> response = predictionServiceClient.BatchPredict(request);

            // Poll until the returned long-running operation is complete
            Operation <BatchPredictResult, OperationMetadata> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            BatchPredictResult result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <BatchPredictResult, OperationMetadata> retrievedResponse = predictionServiceClient.PollOnceBatchPredict(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                BatchPredictResult retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
Exemple #2
0
        /// <summary>Snippet for BatchPredict</summary>
        public void BatchPredict()
        {
            // Snippet: BatchPredict(ModelName,BatchPredictInputConfig,BatchPredictOutputConfig,IDictionary<string, string>,CallSettings)
            // Create client
            PredictionServiceClient predictionServiceClient = PredictionServiceClient.Create();
            // Initialize request argument(s)
            ModelName name = new ModelName("[PROJECT]", "[LOCATION]", "[MODEL]");
            BatchPredictInputConfig      inputConfig  = new BatchPredictInputConfig();
            BatchPredictOutputConfig     outputConfig = new BatchPredictOutputConfig();
            IDictionary <string, string> @params      = new Dictionary <string, string>();
            // Make the request
            Operation <BatchPredictResult, OperationMetadata> response =
                predictionServiceClient.BatchPredict(name, inputConfig, outputConfig, @params);

            // Poll until the returned long-running operation is complete
            Operation <BatchPredictResult, OperationMetadata> completedResponse =
                response.PollUntilCompleted();
            // Retrieve the operation result
            BatchPredictResult result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <BatchPredictResult, OperationMetadata> retrievedResponse =
                predictionServiceClient.PollOnceBatchPredict(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                BatchPredictResult retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
        /// <summary>Snippet for BatchPredict</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public void BatchPredict()
        {
            // Create client
            PredictionServiceClient predictionServiceClient = PredictionServiceClient.Create();
            // Initialize request argument(s)
            string name = "projects/[PROJECT]/locations/[LOCATION]/models/[MODEL]";
            BatchPredictInputConfig      inputConfig  = new BatchPredictInputConfig();
            BatchPredictOutputConfig     outputConfig = new BatchPredictOutputConfig();
            IDictionary <string, string> @params      = new Dictionary <string, string> {
                { "", "" },
            };
            // Make the request
            Operation <BatchPredictResult, OperationMetadata> response = predictionServiceClient.BatchPredict(name, inputConfig, outputConfig, @params);

            // Poll until the returned long-running operation is complete
            Operation <BatchPredictResult, OperationMetadata> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            BatchPredictResult result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <BatchPredictResult, OperationMetadata> retrievedResponse = predictionServiceClient.PollOnceBatchPredict(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                BatchPredictResult retrievedResult = retrievedResponse.Result;
            }
        }