Exemple #1
0
        /// <summary>
        /// Add new data to a trained model.
        /// Documentation https://developers.google.com/prediction/v1.5/reference/trainedmodels/update
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated prediction service.</param>
        /// <param name="id">The unique name for the predictive model.</param>
        /// <param name="body">A valid prediction v1.5 body.</param>
        /// <returns>TrainingResponse</returns>
        public static Training Update(predictionService service, string id, Update body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (id == null)
                {
                    throw new ArgumentNullException(id);
                }

                // Make the request.
                return(service.Trainedmodels.Update(body, id).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Trainedmodels.Update failed.", ex);
            }
        }
        /// <summary>
        /// Submit input and request an output against a hosted model.
        /// Documentation https://developers.google.com/prediction/v1.4/reference/hostedmodels/predict
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated prediction service.</param>
        /// <param name="hostedModelName">The name of a hosted model.</param>
        /// <param name="body">A valid prediction v1.4 body.</param>
        /// <returns>OutputResponse</returns>
        public static Output Predict(predictionService service, string hostedModelName, Input body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (hostedModelName == null)
                {
                    throw new ArgumentNullException(hostedModelName);
                }

                // Make the request.
                return(service.Hostedmodels.Predict(body, hostedModelName).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Hostedmodels.Predict failed.", ex);
            }
        }
        /// <summary>
        /// Delete a trained model.
        /// Documentation https://developers.google.com/prediction/v1.6/reference/trainedmodels/delete
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated prediction service.</param>
        /// <param name="project">The project associated with the model.</param>
        /// <param name="id">The unique name for the predictive model.</param>
        public static void Delete(predictionService service, string project, string id)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (id == null)
                {
                    throw new ArgumentNullException(id);
                }

                // Make the request.
                return(service.Trainedmodels.Delete(project, id).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Trainedmodels.Delete failed.", ex);
            }
        }
        /// <summary>
        /// Submit model id and request a prediction.
        /// Documentation https://developers.google.com/prediction/v1.6/reference/trainedmodels/predict
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated prediction service.</param>
        /// <param name="project">The project associated with the model.</param>
        /// <param name="id">The unique name for the predictive model.</param>
        /// <param name="body">A valid prediction v1.6 body.</param>
        /// <returns>OutputResponse</returns>
        public static Output Predict(predictionService service, string project, string id, Input body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (id == null)
                {
                    throw new ArgumentNullException(id);
                }

                // Make the request.
                return(service.Trainedmodels.Predict(body, project, id).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Trainedmodels.Predict failed.", ex);
            }
        }
        /// <summary>
        /// List available models.
        /// Documentation https://developers.google.com/prediction/v1.6/reference/trainedmodels/list
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated prediction service.</param>
        /// <param name="project">The project associated with the model.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>ListResponse</returns>
        public static List List(predictionService service, string project, TrainedmodelsListOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }

                // Building the initial request.
                var request = service.Trainedmodels.List(project);

                // Applying optional parameters to the request.
                request = (TrainedmodelsResource.ListRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Trainedmodels.List failed.", ex);
            }
        }
        /// <summary>
        /// Begin training your model
        /// Documentation https://developers.google.com/prediction/v1.2/reference/training/insert
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated prediction service.</param>
        /// <param name="body">A valid prediction v1.2 body.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>TrainingResponse</returns>
        public static Training Insert(predictionService service, Training body, TrainingInsertOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }

                // Building the initial request.
                var request = service.Training.Insert(body);

                // Applying optional parameters to the request.
                request = (TrainingResource.InsertRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Training.Insert failed.", ex);
            }
        }
        /// <summary>
        /// Submit data and request a prediction
        /// Documentation https://developers.google.com/prediction/v1.3/reference/training/predict
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated prediction service.</param>
        /// <param name="data">mybucket/mydata resource in Google Storage</param>
        /// <param name="body">A valid prediction v1.3 body.</param>
        /// <returns>OutputResponse</returns>
        public static Output Predict(predictionService service, string data, Input body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (data == null)
                {
                    throw new ArgumentNullException(data);
                }

                // Make the request.
                return(service.Training.Predict(body, data).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Training.Predict failed.", ex);
            }
        }
Exemple #8
0
        /// <summary>
        /// Begin training your model.
        /// Documentation https://developers.google.com/prediction/v1.5/reference/trainedmodels/insert
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated prediction service.</param>
        /// <param name="body">A valid prediction v1.5 body.</param>
        /// <returns>TrainingResponse</returns>
        public static Training Insert(predictionService service, Training body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }

                // Make the request.
                return(service.Trainedmodels.Insert(body).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Trainedmodels.Insert failed.", ex);
            }
        }
        /// <summary>
        /// Delete a trained model
        /// Documentation https://developers.google.com/prediction/v1.2/reference/training/delete
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated prediction service.</param>
        /// <param name="data">mybucket/mydata resource in Google Storage</param>
        public static void Delete(predictionService service, string data)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (data == null)
                {
                    throw new ArgumentNullException(data);
                }

                // Make the request.
                return(service.Training.Delete(data).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Training.Delete failed.", ex);
            }
        }