Пример #1
0
        /// <summary>
        /// Trains a model from a collection of custom forms in a blob storage container.
        /// </summary>
        /// <param name="source">An externally accessible Azure storage blob container Uri.</param>
        /// <param name="filter">Filter to apply to the documents in the source path for training.</param>
        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
        /// <returns>A Operation&lt;CustomModel&gt; to wait on this long-running operation.  Its Operation &lt; CustomModel &gt; .Value upon successful
        /// completion will contain meta-data about the trained model.</returns>
        public virtual Operation <CustomModel> StartTraining(string source, TrainingFileFilter filter = default, CancellationToken cancellationToken = default)
        {
            TrainRequest_internal trainRequest = new TrainRequest_internal(source);

            // TODO: Q1 - if there's a way to default a property value, set filter.Path ="" and set it here in a nicer way.
            // https://github.com/Azure/autorest.csharp/issues/467
            // When this is complete, we will be able to default filter.Path to "".
            // Decision to make, do we always send filter, or only if needed?
            // Tracking with https://github.com/Azure/azure-sdk-for-net/issues/10359
            if (filter != default)
            {
                trainRequest.SourceFilter = filter;
            }

            ResponseWithHeaders <ServiceTrainCustomModelAsyncHeaders> response = _operations.RestClient.TrainCustomModelAsync(trainRequest);

            return(new TrainingOperation(_operations, response.Headers.Location));
        }
        public virtual Operation <CustomLabeledModel> StartTrainingWithLabels(string source, TrainingFileFilter filter = default, CancellationToken cancellationToken = default)
        {
            TrainRequest_internal trainRequest = new TrainRequest_internal()
            {
                Source = source, UseLabelFile = true
            };

            // TODO: Q1 - if there's a way to default a property value, set filter.Path ="" and set it here in a nicer way.
            // https://github.com/Azure/azure-sdk-for-net/issues/10359
            if (filter != default)
            {
                trainRequest.SourceFilter = filter;
            }

            ResponseWithHeaders <TrainCustomModelAsyncHeaders> response = _operations.RestClient.TrainCustomModelAsync(trainRequest);

            return(new TrainingWithLabelsOperation(_operations, response.Headers.Location));
        }
Пример #3
0
        /// <summary>
        /// Trains a model from a collection of custom forms in a blob storage container.
        /// </summary>
        /// <param name="source">An externally accessible Azure storage blob container Uri.</param>
        /// <param name="filter">Filter to apply to the documents in the source path for training.</param>
        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
        /// <returns>A Operation&lt;CustomModel&gt; to wait on this long-running operation.  Its Operation &lt; CustomModel &gt; .Value upon successful
        /// completion will contain meta-data about the trained model.</returns>
        public virtual async Task <Operation <CustomModel> > StartTrainingAsync(string source, TrainingFileFilter filter = default, CancellationToken cancellationToken = default)
        {
            TrainRequest_internal trainRequest = new TrainRequest_internal(source);

            // TODO: Q1 - if there's a way to default a property value, set filter.Path ="" and set it here in a nicer way.
            // https://github.com/Azure/azure-sdk-for-net/issues/10359
            if (filter != default)
            {
                trainRequest.SourceFilter = filter;
            }

            ResponseWithHeaders <ServiceTrainCustomModelAsyncHeaders> response = await _operations.RestClient.TrainCustomModelAsyncAsync(trainRequest).ConfigureAwait(false);

            return(new TrainingOperation(_operations, response.Headers.Location));
        }