1- // Copyright 2020 Google LLC
1+ // Copyright 2021 Google LLC
22//
33// Licensed under the Apache License, Version 2.0 (the "License");
44// you may not use this file except in compliance with the License.
@@ -41,22 +41,36 @@ service ModelService {
4141
4242 // Gets the specified model resource by model ID.
4343 rpc GetModel (GetModelRequest ) returns (Model ) {
44+ option (google.api.http ) = {
45+ get : "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/models/{model_id=*}"
46+ };
4447 option (google.api.method_signature ) = "project_id,dataset_id,model_id" ;
4548 }
4649
4750 // Lists all models in the specified dataset. Requires the READER dataset
48- // role.
51+ // role. After retrieving the list of models, you can get information about a
52+ // particular model by calling the models.get method.
4953 rpc ListModels (ListModelsRequest ) returns (ListModelsResponse ) {
54+ option (google.api.http ) = {
55+ get : "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/models"
56+ };
5057 option (google.api.method_signature ) = "project_id,dataset_id,max_results" ;
5158 }
5259
5360 // Patch specific fields in the specified model.
5461 rpc PatchModel (PatchModelRequest ) returns (Model ) {
62+ option (google.api.http ) = {
63+ patch : "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/models/{model_id=*}"
64+ body : "model"
65+ };
5566 option (google.api.method_signature ) = "project_id,dataset_id,model_id,model" ;
5667 }
5768
5869 // Deletes the model specified by modelId from the dataset.
5970 rpc DeleteModel (DeleteModelRequest ) returns (google.protobuf.Empty ) {
71+ option (google.api.http ) = {
72+ delete : "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/models/{model_id=*}"
73+ };
6074 option (google.api.method_signature ) = "project_id,dataset_id,model_id" ;
6175 }
6276}
@@ -92,6 +106,7 @@ message Model {
92106 // Indicates the method used to initialize the centroids for KMeans
93107 // clustering algorithm.
94108 enum KmeansInitializationMethod {
109+ // Unspecified initialization method.
95110 KMEANS_INITIALIZATION_METHOD_UNSPECIFIED = 0 ;
96111
97112 // Initializes the centroids randomly.
@@ -123,7 +138,7 @@ message Model {
123138 // Median absolute error.
124139 google.protobuf.DoubleValue median_absolute_error = 4 ;
125140
126- // R^2 score.
141+ // R^2 score. This corresponds to r2_score in ML.EVALUATE.
127142 google.protobuf.DoubleValue r_squared = 5 ;
128143 }
129144
@@ -305,7 +320,7 @@ message Model {
305320 // Mean of squared distances between each sample to its cluster centroid.
306321 google.protobuf.DoubleValue mean_squared_distance = 2 ;
307322
308- // [Beta] Information for all clusters.
323+ // Information for all clusters.
309324 repeated Cluster clusters = 3 ;
310325 }
311326
@@ -346,30 +361,50 @@ message Model {
346361 // is not 1.
347362 bool has_drift = 3 ;
348363
349- // The id to indicate different time series.
364+ // The time_series_id value for this time series. It will be one of
365+ // the unique values from the time_series_id_column specified during
366+ // ARIMA model training. Only present when time_series_id_column
367+ // training option was used.
350368 string time_series_id = 4 ;
351369
370+ // The tuple of time_series_ids identifying this time series. It will
371+ // be one of the unique tuples of values present in the
372+ // time_series_id_columns specified during ARIMA model training. Only
373+ // present when time_series_id_columns training option was used and
374+ // the order of values here are same as the order of
375+ // time_series_id_columns.
376+ repeated string time_series_ids = 9 ;
377+
352378 // Seasonal periods. Repeated because multiple periods are supported
353379 // for one time series.
354380 repeated SeasonalPeriod.SeasonalPeriodType seasonal_periods = 5 ;
381+
382+ // If true, holiday_effect is a part of time series decomposition result.
383+ google.protobuf.BoolValue has_holiday_effect = 6 ;
384+
385+ // If true, spikes_and_dips is a part of time series decomposition result.
386+ google.protobuf.BoolValue has_spikes_and_dips = 7 ;
387+
388+ // If true, step_changes is a part of time series decomposition result.
389+ google.protobuf.BoolValue has_step_changes = 8 ;
355390 }
356391
357392 // Non-seasonal order.
358- repeated ArimaOrder non_seasonal_order = 1 ;
393+ repeated ArimaOrder non_seasonal_order = 1 [ deprecated = true ] ;
359394
360395 // Arima model fitting metrics.
361- repeated ArimaFittingMetrics arima_fitting_metrics = 2 ;
396+ repeated ArimaFittingMetrics arima_fitting_metrics = 2 [ deprecated = true ] ;
362397
363398 // Seasonal periods. Repeated because multiple periods are supported for one
364399 // time series.
365- repeated SeasonalPeriod.SeasonalPeriodType seasonal_periods = 3 ;
400+ repeated SeasonalPeriod.SeasonalPeriodType seasonal_periods = 3 [ deprecated = true ] ;
366401
367402 // Whether Arima model fitted with drift or not. It is always false when d
368403 // is not 1.
369- repeated bool has_drift = 4 ;
404+ repeated bool has_drift = 4 [ deprecated = true ] ;
370405
371406 // Id to differentiate different time series for the large-scale case.
372- repeated string time_series_id = 5 ;
407+ repeated string time_series_id = 5 [ deprecated = true ] ;
373408
374409 // Repeated as there can be many metric sets (one for each model) in
375410 // auto-arima and the large-scale case.
@@ -462,6 +497,7 @@ message Model {
462497
463498 // Information about a single training query run for the model.
464499 message TrainingRun {
500+ // Options used in model training.
465501 message TrainingOptions {
466502 // The maximum number of iterations in training. Used only for iterative
467503 // training algorithms.
@@ -539,7 +575,7 @@ message Model {
539575 // Number of clusters for clustering models.
540576 int64 num_clusters = 21 ;
541577
542- // [Beta] Google Cloud Storage URI from which the model was imported. Only
578+ // Google Cloud Storage URI from which the model was imported. Only
543579 // applicable for imported models.
544580 string model_uri = 22 ;
545581
@@ -608,10 +644,12 @@ message Model {
608644 // effects modeling is enabled.
609645 HolidayRegion holiday_region = 42 ;
610646
611- // The id column that will be used to indicate different time series to
612- // forecast in parallel.
647+ // The time series id column that was used during ARIMA model training.
613648 string time_series_id_column = 43 ;
614649
650+ // The time series id columns that were used during ARIMA model training.
651+ repeated string time_series_id_columns = 51 ;
652+
615653 // The number of periods ahead that need to be forecasted.
616654 int64 horizon = 44 ;
617655
@@ -623,6 +661,16 @@ message Model {
623661
624662 // The max value of non-seasonal p and q.
625663 int64 auto_arima_max_order = 46 ;
664+
665+ // If true, perform decompose time series and save the results.
666+ google.protobuf.BoolValue decompose_time_series = 50 ;
667+
668+ // If true, clean spikes and dips in the input time series.
669+ google.protobuf.BoolValue clean_spikes_and_dips = 52 ;
670+
671+ // If true, detect step changes and make data adjustment in the input time
672+ // series.
673+ google.protobuf.BoolValue adjust_step_changes = 53 ;
626674 }
627675
628676 // Information about a single iteration of the training run.
@@ -670,12 +718,35 @@ message Model {
670718 // when d is not 1.
671719 bool has_drift = 4 ;
672720
673- // The id to indicate different time series.
721+ // The time_series_id value for this time series. It will be one of
722+ // the unique values from the time_series_id_column specified during
723+ // ARIMA model training. Only present when time_series_id_column
724+ // training option was used.
674725 string time_series_id = 5 ;
675726
727+ // The tuple of time_series_ids identifying this time series. It will
728+ // be one of the unique tuples of values present in the
729+ // time_series_id_columns specified during ARIMA model training. Only
730+ // present when time_series_id_columns training option was used and
731+ // the order of values here are same as the order of
732+ // time_series_id_columns.
733+ repeated string time_series_ids = 10 ;
734+
676735 // Seasonal periods. Repeated because multiple periods are supported
677736 // for one time series.
678737 repeated SeasonalPeriod.SeasonalPeriodType seasonal_periods = 6 ;
738+
739+ // If true, holiday_effect is a part of time series decomposition
740+ // result.
741+ google.protobuf.BoolValue has_holiday_effect = 7 ;
742+
743+ // If true, spikes_and_dips is a part of time series decomposition
744+ // result.
745+ google.protobuf.BoolValue has_spikes_and_dips = 8 ;
746+
747+ // If true, step_changes is a part of time series decomposition
748+ // result.
749+ google.protobuf.BoolValue has_step_changes = 9 ;
679750 }
680751
681752 // This message is repeated because there are multiple arima models
@@ -748,29 +819,32 @@ message Model {
748819 // Matrix factorization model.
749820 MATRIX_FACTORIZATION = 4 ;
750821
751- // [Beta] DNN classifier model.
822+ // DNN classifier model.
752823 DNN_CLASSIFIER = 5 ;
753824
754- // [Beta] An imported TensorFlow model.
825+ // An imported TensorFlow model.
755826 TENSORFLOW = 6 ;
756827
757- // [Beta] DNN regressor model.
828+ // DNN regressor model.
758829 DNN_REGRESSOR = 7 ;
759830
760- // [Beta] Boosted tree regressor model.
831+ // Boosted tree regressor model.
761832 BOOSTED_TREE_REGRESSOR = 9 ;
762833
763- // [Beta] Boosted tree classifier model.
834+ // Boosted tree classifier model.
764835 BOOSTED_TREE_CLASSIFIER = 10 ;
765836
766- // [Beta] ARIMA model.
837+ // ARIMA model.
767838 ARIMA = 11 ;
768839
769840 // [Beta] AutoML Tables regression model.
770841 AUTOML_REGRESSOR = 12 ;
771842
772843 // [Beta] AutoML Tables classification model.
773844 AUTOML_CLASSIFIER = 13 ;
845+
846+ // New name for the ARIMA model.
847+ ARIMA_PLUS = 19 ;
774848 }
775849
776850 // Loss metric to evaluate model training performance.
@@ -840,6 +914,9 @@ message Model {
840914
841915 // Hourly data.
842916 HOURLY = 7 ;
917+
918+ // Per-minute data.
919+ PER_MINUTE = 8 ;
843920 }
844921
845922 // Type of supported holiday regions for time series forecasting models.
@@ -1141,6 +1218,9 @@ message Model {
11411218 // Output only. Label columns that were used to train this model.
11421219 // The output of the model will have a "predicted_" prefix to these columns.
11431220 repeated StandardSqlField label_columns = 11 [(google.api.field_behavior ) = OUTPUT_ONLY ];
1221+
1222+ // The best trial_id across all training runs.
1223+ int64 best_trial_id = 19 [deprecated = true ];
11441224}
11451225
11461226message GetModelRequest {
0 commit comments