google_cloud_bigquery/http/model/
mod.rs

1use std::collections::HashMap;
2
3use time::OffsetDateTime;
4
5use crate::http::table::TableReference;
6use crate::http::types::{EncryptionConfiguration, StandardSqlField};
7
8pub mod delete;
9pub mod get;
10pub mod list;
11pub mod patch;
12
13#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug)]
14#[serde(rename_all = "camelCase")]
15pub struct Model {
16    /// Output only. A hash of this resource.
17    pub etag: String,
18    /// Required. Unique identifier for this model.
19    pub model_reference: ModelReference,
20    /// Output only. The time when this model was created, in millisecs since the epoch.
21    #[serde(deserialize_with = "crate::http::from_str")]
22    pub creation_time: i64,
23    /// Output only. The time when this model was last modified, in millisecs since the epoch.
24    #[serde(deserialize_with = "crate::http::from_str")]
25    pub last_modified_time: u64,
26    /// Optional. A user-friendly description of this model.
27    pub description: Option<String>,
28    /// Optional. A descriptive name for this model.
29    pub friendly_name: Option<String>,
30    /// The labels associated with this model.
31    /// You can use these to organize and group your models. Label keys and values can be no longer than 63 characters,
32    /// can only contain lowercase letters, numeric characters, underscores and dashes.
33    /// International characters are allowed. Label values are optional.
34    /// Label keys must start with a letter and each label in the list must have a different key.
35    /// An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
36    pub labels: Option<HashMap<String, String>>,
37    /// Optional. The time when this model expires, in milliseconds since the epoch.
38    /// If not present, the model will persist indefinitely. Expired models will be deleted and their storage reclaimed. The defaultTableExpirationMs property of the encapsulating dataset can be used to set a default expirationTime on newly created models.
39    #[serde(default, deserialize_with = "crate::http::from_str_option")]
40    pub expiration_time: Option<i64>,
41    /// Output only. The geographic location where the model resides. This value is inherited from the dataset.
42    pub location: Option<String>,
43    /// Custom encryption configuration (e.g., Cloud KMS keys).
44    /// This shows the encryption configuration of the model data while stored in BigQuery storage.
45    /// This field can be used with models.patch to update encryption key for an already encrypted model.
46    pub encryption_configuration: Option<EncryptionConfiguration>,
47    /// Output only. Type of the model resource.
48    pub model_type: Option<ModelType>,
49    /// Information for all training runs in increasing order of startTime.
50    pub training_runs: Option<Vec<TrainingRun>>,
51    /// Output only. Input feature columns that were used to train this model.
52    pub feature_columns: Option<Vec<StandardSqlField>>,
53    /// Output only. Label columns that were used to train this model.
54    /// The output of the model will have a "predicted_" prefix to these columns.
55    pub label_columns: Option<Vec<StandardSqlField>>,
56    /// Output only. All hyperparameter search spaces in this model.
57    pub hparam_search_spaces: Option<HparamSearchSpaces>,
58    /// Output only. The default trialId to use in TVFs when the trialId is not passed in. For single-objective hyperparameter tuning models, this is the best trial ID. For multi-objective hyperparameter tuning models, this is the smallest trial ID among all Pareto optimal trials.
59    #[serde(default, deserialize_with = "crate::http::from_str_option")]
60    pub default_trial_id: Option<i64>,
61    /// Output only. Trials of a hyperparameter tuning model sorted by trialId.
62    pub hparam_trials: Option<Vec<HparamTuningTrial>>,
63    /// Output only. For single-objective hyperparameter tuning models, it only contains the best trial.
64    /// For multi-objective hyperparameter tuning models, it contains all Pareto optimal trials sorted by trialId.
65    #[serde(default, deserialize_with = "crate::http::from_str_vec_option")]
66    pub optimal_trial_ids: Option<Vec<i64>>,
67    /// Output only. Remote model info
68    pub remote_model_info: Option<RemoteModelInfo>,
69}
70
71#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug)]
72#[serde(rename_all = "camelCase")]
73pub struct TrainingRun {
74    /// Output only. Options that were used for this training run, includes user specified and default options that were used.
75    pub training_options: Option<TrainingOptions>,
76    /// Output only. The start time of this training run.
77    #[serde(default, with = "time::serde::rfc3339::option")]
78    pub start_time: Option<OffsetDateTime>,
79    /// Output only. Output of each iteration run, results.size() <= maxIterations.
80    pub results: Option<Vec<IterationResult>>,
81    /// Output only. The evaluation metrics over training/eval data that were computed at the end of training.
82    pub evaluation_metrics: Option<EvaluationMetrics>,
83    /// Output only. Data split result of the training run. Only set when the input data is actually split.
84    pub data_split_result: Option<DataSplitResult>,
85    /// Output only. Global explanation contains the explanation of top features on the model level. Applies to both regression and classification models.
86    pub model_level_global_explanation: Option<GlobalExplanation>,
87    /// Output only. Global explanation contains the explanation of top features on the class level. Applies to classification models only.
88    pub class_level_global_explanations: Option<Vec<GlobalExplanation>>,
89    /// The model id in the Vertex AI Model Registry for this training run.
90    pub vertex_ai_model_id: Option<String>,
91    /// Output only. The model version in the Vertex AI Model Registry for this training run.
92    pub vertex_ai_model_version: Option<String>,
93}
94
95#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
96#[serde(rename_all = "camelCase")]
97pub struct DataSplitResult {
98    /// Table reference of the training data after split.
99    pub training_table: Option<TableReference>,
100    /// Table reference of the evaluation data after split.
101    pub evaluation_table: Option<TableReference>,
102    /// Table reference of the test data after split.
103    pub test_table: Option<TableReference>,
104}
105
106#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug)]
107#[serde(rename_all = "camelCase")]
108pub struct GlobalExplanation {
109    /// A list of the top global explanations. Sorted by absolute value of attribution in descending order.
110    pub explanations: Option<Vec<Explanation>>,
111    /// Class label for this set of global explanations.
112    /// Will be empty/null for binary logistic and linear regression models. Sorted alphabetically in descending order.
113    pub class_label: Option<String>,
114}
115
116#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug)]
117#[serde(rename_all = "camelCase")]
118pub struct Explanation {
119    /// The full feature name.
120    /// For non-numerical features, will be formatted like <column_name>.<encoded_feature_name>.
121    /// Overall size of feature name will always be truncated to first 120 characters..
122    pub feature_name: String,
123    /// Attribution of feature.
124    pub attribution: f64,
125}
126
127#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug)]
128#[serde(rename_all = "camelCase")]
129pub struct RemoteModelInfo {
130    /// Output only. Fully qualified name of the user-provided connection object of the remote model.
131    /// Format: "projects/{projectId}/locations/{locationId}/connections/{connectionId}"
132    pub connection: String,
133    /// Output only. Max number of rows in each batch sent to the remote service. If unset, the number of rows in each batch is set dynamically.
134    #[serde(default, deserialize_with = "crate::http::from_str_option")]
135    pub max_batching_rows: Option<i64>,
136    /// Output only. The endpoint for remote model.
137    pub endpoint: String,
138    /// Output only. The remote service type for remote model.
139    pub remote_service_type: RemoteServiceType,
140}
141
142#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug)]
143#[serde(rename_all = "camelCase")]
144pub struct HparamSearchSpaces {
145    /// Learning rate of training jobs.
146    pub learn_rate: Option<DoubleHparamSearchSpace>,
147    /// L1 regularization coefficient.
148    pub l1_reg: Option<DoubleHparamSearchSpace>,
149    /// L2 regularization coefficient.
150    pub l2_reg: Option<DoubleHparamSearchSpace>,
151    /// Number of clusters for k-means.
152    pub num_clusters: Option<IntHparamSearchSpace>,
153    /// Number of latent factors to train on.
154    pub num_factors: Option<IntHparamSearchSpace>,
155    /// Hidden units for neural network models.
156    pub hidden_units: Option<IntArrayHparamSearchSpace>,
157    /// Mini batch sample size.
158    pub batch_size: Option<IntHparamSearchSpace>,
159    /// Dropout probability for dnn model training and boosted tree models using dart booster.
160    pub dropout: Option<DoubleHparamSearchSpace>,
161    /// Maximum depth of a tree for boosted tree models.
162    pub max_tree_depth: Option<IntHparamSearchSpace>,
163    /// Subsample the training data to grow tree to prevent overfitting for boosted tree models.
164    pub subsample: Option<DoubleHparamSearchSpace>,
165    /// Minimum split loss for boosted tree models.
166    pub min_split_loss: Option<DoubleHparamSearchSpace>,
167    /// Hyperparameter for matrix factoration when implicit feedback type is specified.
168    pub wals_alpha: Option<DoubleHparamSearchSpace>,
169    /// Booster type for boosted tree models.
170    pub booster_type: Option<StringHparamSearchSpace>,
171    /// Number of parallel trees for boosted tree models.
172    pub num_parallel_tree: Option<IntHparamSearchSpace>,
173    /// Dart normalization type for boosted tree models.
174    pub dart_normalize_type: Option<StringHparamSearchSpace>,
175    /// Tree construction algorithm for boosted tree models.
176    pub tree_method: Option<StringHparamSearchSpace>,
177    /// Minimum sum of instance weight needed in a child for boosted tree models.
178    pub min_tree_child_weight: Option<IntHparamSearchSpace>,
179    /// Subsample ratio of columns when constructing each tree for boosted tree models.
180    pub colsample_bytree: Option<DoubleHparamSearchSpace>,
181    /// Subsample ratio of columns for each level for boosted tree models.
182    pub colsample_bylevel: Option<DoubleHparamSearchSpace>,
183    /// Subsample ratio of columns for each node(split) for boosted tree models.
184    pub colsample_bynode: Option<DoubleHparamSearchSpace>,
185    /// Activation functions of neural network models.
186    pub activation_fn: Option<StringHparamSearchSpace>,
187    /// Optimizer of TF models.
188    pub optimizer: Option<StringHparamSearchSpace>,
189}
190
191#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug)]
192#[serde(rename_all = "camelCase")]
193pub enum DoubleHparamSearchSpace {
194    Range(DoubleRange),
195    Candidates(DoubleCandidates),
196}
197
198#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug)]
199#[serde(rename_all = "camelCase")]
200pub struct DoubleRange {
201    pub min: f64,
202    pub max: f64,
203}
204
205#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug)]
206#[serde(rename_all = "camelCase")]
207pub struct DoubleCandidates {
208    pub candidates: Vec<f64>,
209}
210
211#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug)]
212#[serde(rename_all = "camelCase")]
213pub enum IntHparamSearchSpace {
214    Range(IntRange),
215    Candidates(IntCandidates),
216}
217
218#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug)]
219#[serde(rename_all = "camelCase")]
220pub struct IntRange {
221    #[serde(deserialize_with = "crate::http::from_str")]
222    pub min: i64,
223    #[serde(deserialize_with = "crate::http::from_str")]
224    pub max: i64,
225}
226
227#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug)]
228#[serde(rename_all = "camelCase")]
229pub struct IntCandidates {
230    #[serde(deserialize_with = "crate::http::from_str_vec")]
231    pub candidates: Vec<i64>,
232}
233
234#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug)]
235#[serde(rename_all = "camelCase")]
236pub struct IntArrayHparamSearchSpace {
237    pub candidates: Vec<IntArray>,
238}
239
240#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug)]
241#[serde(rename_all = "camelCase")]
242pub struct IntArray {
243    #[serde(deserialize_with = "crate::http::from_str")]
244    pub elements: i64,
245}
246
247#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug)]
248#[serde(rename_all = "camelCase")]
249pub struct StringHparamSearchSpace {
250    pub candidates: Vec<String>,
251}
252
253#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
254#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
255pub enum RemoteServiceType {
256    #[default]
257    RemoteServiceTypeUnspecified,
258    CloudAiTranslateV3,
259    CloudAiVisionV1,
260    CloudAiNaturalLanguageV1,
261}
262
263#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
264#[serde(rename_all = "camelCase")]
265pub struct ModelReference {
266    /// Required. The ID of the project containing this table.
267    pub project_id: String,
268    /// Required. The ID of the dataset containing this table.
269    pub dataset_id: String,
270    /// Required. The ID of the model.
271    /// The ID must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum length is 1,024 characters.    pub model_id: String,
272    pub model_id: String,
273}
274
275#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
276#[serde(rename_all = "camelCase")]
277pub struct IterationResult {
278    /// Index of the iteration, 0 based.
279    pub index: i32,
280    /// Time taken to run the iteration in milliseconds.
281    #[serde(default, deserialize_with = "crate::http::from_str_option")]
282    pub duration_ms: Option<i64>,
283    /// Loss computed on the training data at the end of iteration.
284    pub training_loss: Option<f64>,
285    /// Loss computed on the eval data at the end of iteration.
286    pub eval_loss: Option<f64>,
287    /// Learn rate used for this iteration.
288    pub learn_rate: Option<f64>,
289    /// Information about top clusters for clustering models.
290    pub cluster_infos: Option<Vec<ClusterInfo>>,
291    pub arima_result: Option<ArimaResult>,
292    /// The information of the principal components.
293    pub principal_component_infos: Option<Vec<PrincipalComponentInfo>>,
294}
295
296#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
297#[serde(rename_all = "camelCase")]
298pub struct ClusterInfo {
299    /// Centroid id.
300    #[serde(default, deserialize_with = "crate::http::from_str_option")]
301    pub centroid_id: Option<i64>,
302    /// Cluster radius, the average distance from centroid to each point assigned to the cluster.
303    pub cluster_radius: Option<f64>,
304    /// Cluster size, the total number of points assigned to the cluster.
305    #[serde(default, deserialize_with = "crate::http::from_str_option")]
306    pub cluster_size: Option<i64>,
307}
308
309#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
310#[serde(rename_all = "camelCase")]
311pub struct ArimaResult {
312    /// This message is repeated because there are multiple arima models fitted in auto-arima. For non-auto-arima model, its size is one.
313    pub arima_model_info: Option<Vec<ArimaModelInfo>>,
314    /// Seasonal periods. Repeated because multiple periods are supported for one time series.
315    pub seasonal_periods: Option<Vec<SeasonalPeriodType>>,
316}
317
318#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
319#[serde(rename_all = "camelCase")]
320pub struct ArimaModelInfo {
321    /// Non-seasonal order.
322    pub non_seasonal_order: Option<ArimaOrder>,
323    /// Arima coefficients.
324    pub arima_coefficients: Option<ArimaCoefficients>,
325    /// Arima fitting metrics.
326    pub arima_fitting_metrics: Option<ArimaFittingMetrics>,
327    /// Whether Arima model fitted with drift or not. It is always false when d is not 1.
328    pub has_drift: Option<bool>,
329    /// The timeSeriesId value for this time series.
330    /// It will be one of the unique values from the timeSeriesIdColumn specified during ARIMA model training.
331    /// Only present when timeSeriesIdColumn training option was used.
332    pub time_series_id: Option<String>,
333    /// The tuple of timeSeriesIds identifying this time series.
334    /// It will be one of the unique tuples of values present in the timeSeriesIdColumns specified
335    /// during ARIMA model training.
336    /// Only present when timeSeriesIdColumns training option was used and
337    /// the order of values here are same as the order of timeSeriesIdColumns.
338    pub time_series_ids: Option<Vec<String>>,
339    /// Seasonal periods. Repeated because multiple periods are supported for one time series.
340    pub seasonal_periods: Option<Vec<SeasonalPeriodType>>,
341    /// If true, holiday_effect is a part of time series decomposition result.
342    pub has_holiday_effect: Option<bool>,
343    /// If true, spikes_and_dips is a part of time series decomposition result.
344    pub has_spikes_and_dips: Option<bool>,
345    /// If true, step_changes is a part of time series decomposition result.
346    pub has_step_changes: Option<bool>,
347}
348
349#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
350#[serde(rename_all = "camelCase")]
351pub struct ArimaCoefficients {
352    /// Auto-regressive coefficients, an array of double.
353    pub auto_regressive_coefficients: Option<Vec<f64>>,
354    /// Moving-average coefficients, an array of double.
355    pub moving_average_coefficients: Option<Vec<f64>>,
356    /// Intercept coefficient, just a double not an array
357    pub intercept_coefficient: Option<f64>,
358}
359
360#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
361#[serde(rename_all = "camelCase")]
362pub struct ArimaFittingMetrics {
363    /// Log-likelihood.
364    pub log_likelihood: Option<f64>,
365    /// AIC.
366    pub aic: Option<f64>,
367    /// Variance.
368    pub variance: Option<f64>,
369}
370
371#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
372#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
373pub enum SeasonalPeriodType {
374    #[default]
375    SeasonalPeriodTypeUnspecified,
376    NoSeasonality,
377    Daily,
378    Weekly,
379    Monthly,
380    Quarterly,
381    Yearly,
382}
383
384#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
385#[serde(rename_all = "camelCase")]
386pub struct PrincipalComponentInfo {
387    /// Id of the principal component.
388    #[serde(deserialize_with = "crate::http::from_str")]
389    pub principal_component_id: i64,
390    /// Explained variance by this principal component, which is simply the eigenvalue.
391    pub explained_variance: Option<f64>,
392    /// Explained_variance over the total explained variance.
393    pub explained_variance_ratio: Option<f64>,
394    /// The explainedVariance is pre-ordered in the descending order to compute
395    /// the cumulative explained variance ratio.
396    pub cumulative_explained_variance_ratio: Option<f64>,
397}
398
399#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
400#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
401pub enum ModelType {
402    #[default]
403    ModelTypeUnspecified,
404    /// Linear regression model.
405    LinearRegression,
406    ///Logistic regression based classification model.
407    LogisticRegression,
408    /// K-means clustering model.
409    Kmeans,
410    /// Matrix factorization model.
411    MatrixFactorization,
412    /// DNN classifier model.
413    DnnClassifier,
414    ///An imported TensorFlow model.
415    Tensorflow,
416    /// DNN regressor model.
417    DnnRegression,
418    /// Boosted tree regressor model.
419    BoostedTreeRegressor,
420    /// Boosted tree classifier model.
421    BoostedTreeClassifier,
422    ///Arima Model
423    Arima,
424    /// AutoML Tables regression model.
425    AutomlRegressor,
426    /// AutoML Tables classification model.
427    AutomlClassifier,
428    /// Prinpical Component Analysis model.
429    Pca,
430    /// Autoencoder model.
431    Autoencoder,
432    /// New name for the ARIMA model.
433    ArimaPlus,
434}
435
436#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
437#[serde(rename_all = "camelCase")]
438pub struct HparamTuningTrial {
439    /// 1-based index of the trial.
440    #[serde(default, deserialize_with = "crate::http::from_str_option")]
441    pub trial_id: Option<i64>,
442    /// Starting time of the trial.
443    #[serde(default, deserialize_with = "crate::http::from_str_option")]
444    pub start_time_ms: Option<i64>,
445    /// Ending time of the trial.
446    #[serde(default, deserialize_with = "crate::http::from_str_option")]
447    pub end_time_ms: Option<i64>,
448    /// The hyperprameters selected for this trial.
449    pub hparams: Option<TrainingOptions>,
450    /// Evaluation metrics of this trial calculated on the test data. Empty in Job API.
451    pub evaluation_metrics: Option<EvaluationMetrics>,
452    /// The status of the trial.
453    pub status: Option<TrialStatus>,
454    /// Error message for FAILED and INFEASIBLE trial.
455    pub error_message: Option<String>,
456    /// Loss computed on the training data at the end of trial.
457    pub training_loss: Option<f64>,
458    /// Loss computed on the eval data at the end of trial.
459    pub eval_loss: Option<f64>,
460    /// Hyperparameter tuning evaluation metrics of this trial calculated on the eval data
461    /// . Unlike evaluationMetrics, only the fields corresponding to the hparamTuningObjectives are set.
462    pub hparam_tuning_evaluation_metrics: Option<EvaluationMetrics>,
463}
464
465#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
466#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
467pub enum TrialStatus {
468    #[default]
469    TrialStatusUnspecified,
470    NotStarted,
471    Running,
472    Succeeded,
473    Failed,
474    Infeasible,
475    StoppedEarly,
476}
477
478#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
479#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
480pub enum LossType {
481    #[default]
482    LossTypeUnspecified,
483    MeanSquaredLoss,
484    MeanLogLoss,
485}
486
487#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
488#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
489pub enum DataSplitMethod {
490    #[default]
491    DataSplitMethodUnspecified,
492    Random,
493    Custom,
494    Sequential,
495    NoSplit,
496    AutoSplit,
497}
498
499#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
500#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
501pub enum LearnRateStrategy {
502    #[default]
503    LearnRateStrategyUnspecified,
504    LineSearch,
505    Constant,
506}
507
508#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
509#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
510pub enum DistanceType {
511    #[default]
512    DistanceTypeUnspecified,
513    Euclidean,
514    Cosine,
515}
516
517#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
518#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
519pub enum OptimizationStrategy {
520    #[default]
521    OptimizationStrategyUnspecified,
522    BatchGradientDescent,
523    NormalEquation,
524}
525
526#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
527#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
528pub enum BoosterType {
529    #[default]
530    BoosterTypeUnspecified,
531    Gbtree,
532    Dart,
533}
534
535#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
536#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
537pub enum DartNormalizeType {
538    #[default]
539    DataNormalizeTypeUnspecified,
540    Tree,
541    Forest,
542}
543
544#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
545#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
546pub enum TestMethod {
547    #[default]
548    TreeMethodUnspecified,
549    Auto,
550    Exact,
551    Approx,
552    Hist,
553}
554
555#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
556#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
557pub enum FeedbackType {
558    #[default]
559    FeedbackTypeUnspecified,
560    Implicit,
561    Explicit,
562}
563
564#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
565#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
566pub enum KmeansInitializationMethod {
567    #[default]
568    KmeansInitializationMethodUnspecified,
569    Random,
570    Custom,
571    KmeansPlusPlus,
572}
573
574#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
575#[serde(rename_all = "camelCase")]
576pub struct ArimaOrder {
577    /// Order of the autoregressive part.
578    #[serde(default, deserialize_with = "crate::http::from_str_option")]
579    pub p: Option<i64>,
580    /// Order of the differencing part.
581    #[serde(default, deserialize_with = "crate::http::from_str_option")]
582    pub d: Option<i64>,
583    /// Order of the moving-average part.
584    #[serde(default, deserialize_with = "crate::http::from_str_option")]
585    pub q: Option<i64>,
586}
587
588#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
589#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
590pub enum DataFrequency {
591    #[default]
592    DataFrequencyUnspecified,
593    AutoFrequency,
594    Yearly,
595    Quarterly,
596    Monthly,
597    Weekly,
598    Daily,
599    Hourly,
600    PerMinute,
601}
602
603#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
604#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
605pub enum HolidayRegion {
606    #[default]
607    HolidayRegionUnspecified,
608    Global,
609    Na,
610    Japac,
611    Emea,
612    Ae,
613    Ar,
614    At,
615    Au,
616    Be,
617    Br,
618    Ca,
619    Ch,
620    Cl,
621    Cn,
622    Co,
623    Cs,
624    Cz,
625    De,
626    Dk,
627    Dz,
628    Ec,
629    Ee,
630    Eg,
631    Es,
632    Fi,
633    Fr,
634    Gb,
635    Gr,
636    Hk,
637    Hu,
638    Id,
639    Ie,
640    Il,
641    In,
642    Ir,
643    It,
644    Jp,
645    Kr,
646    Lv,
647    Ma,
648    Mx,
649    My,
650    Mg,
651    Nl,
652    No,
653    Nz,
654    Pe,
655    Ph,
656    Pk,
657    Pl,
658    Pt,
659    Ro,
660    Rs,
661    Ru,
662    Sa,
663    Se,
664    Sg,
665    Si,
666    Sk,
667    Th,
668    Tr,
669    Tw,
670    Ua,
671    Us,
672    Ve,
673    Vn,
674    Za,
675}
676
677#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
678#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
679pub enum HparamTuningObjective {
680    #[default]
681    HparamTuningObjectiveUnspecified,
682    MeanAbsoluteError,
683    MeanSquaredError,
684    MeanSquaredLogError,
685    MedianAbsoluteError,
686    RSquared,
687    ExplainedVariance,
688    Precision,
689    Recall,
690    Accuracy,
691    F1Score,
692    LogLoss,
693    RocAuc,
694    DaviesBouldinIndex,
695    MeanAveragePrecision,
696    NormalizedDiscountedCumulativeGain,
697    AverageRank,
698}
699
700#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
701#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
702pub enum TreeMethod {
703    #[default]
704    TreeMethodUnspecified,
705    Auto,
706    Exact,
707    Approx,
708    Hist,
709}
710
711#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
712#[serde(rename_all = "camelCase")]
713pub struct TrainingOptions {
714    /// The maximum number of iterations in training. Used only for iterative training algorithms.
715    #[serde(default, deserialize_with = "crate::http::from_str_option")]
716    pub max_iterations: Option<i64>,
717    /// Type of loss function used during training run.
718    pub loss_type: Option<LossType>,
719    /// Learning rate in training. Used only for iterative training algorithms.
720    pub learn_rate: Option<f64>,
721    /// L1 regularization coefficient.
722    pub l1_regularization: Option<f64>,
723    /// L2 regularization coefficient.
724    pub l2_regularization: Option<f64>,
725    /// When earlyStop is true, stops training when accuracy improvement is less than 'minRelativeProgress'. Used only for iterative training algorithms.
726    pub min_relative_progress: Option<f64>,
727    /// Whether to train a model from the last checkpoint.
728    pub warm_start: Option<bool>,
729    /// Whether to stop early when the loss doesn't improve significantly any more (compared to minRelativeProgress). Used only for iterative training algorithms.
730    pub early_stop: Option<bool>,
731    /// Name of input label columns in training data.
732    pub input_label_columns: Option<Vec<String>>,
733    /// The data split type for training and evaluation, e.g. RANDOM.
734    pub data_split_method: Option<DataSplitMethod>,
735    /// The fraction of evaluation data over the whole input data.
736    /// The rest of data will be used as training data. The format should be double. Accurate to two decimal places. Default value is 0.2.
737    pub data_split_eval_fraction: Option<f64>,
738    /// The column to split data with. This column won't be used as a feature.
739    /// 1. When dataSplitMethod is CUSTOM, the corresponding column should be boolean.
740    ///    The rows with true value tag are eval data, and the false are training data.
741    /// 2. When dataSplitMethod is SEQ, the first DATA_SPLIT_EVAL_FRACTION rows (from smallest to largest) in the corresponding column are used as training data,
742    ///    and the rest are eval data.
743    ///    It respects the order in Orderable data types: https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#data-type-properties
744    pub data_split_column: Option<String>,
745    /// The strategy to determine learn rate for the current iteration.
746    pub learn_rate_strategy: Option<LearnRateStrategy>,
747    /// Specifies the initial learning rate for the line search learn rate strategy.
748    pub initial_learn_rate: Option<f64>,
749    /// Weights associated with each label class, for rebalancing the training data.
750    /// Only applicable for classification models.
751    /// An object containing a list of "key": value pairs. Example:
752    /// { "name": "wrench", "mass": "1.3kg", "count": "3" }.
753    pub label_class_weights: Option<HashMap<String, f64>>,
754    /// User column specified for matrix factorization models.
755    pub user_column: Option<String>,
756    /// Item column specified for matrix factorization models.
757    pub item_column: Option<String>,
758    /// Distance type for clustering models.
759    pub distance_type: Option<DistanceType>,
760    /// Number of clusters for clustering models.
761    #[serde(default, deserialize_with = "crate::http::from_str_option")]
762    pub num_clusters: Option<i64>,
763    /// Google Cloud Storage URI from which the model was imported.
764    /// Only applicable for imported models.
765    pub model_uri: Option<String>,
766    /// Optimization strategy for training linear regression models.
767    pub optimization_strategy: Option<OptimizationStrategy>,
768    /// Hidden units for dnn models.
769    #[serde(default, deserialize_with = "crate::http::from_str_vec_option")]
770    pub hidden_units: Option<Vec<i64>>,
771    /// Batch size for dnn models.
772    #[serde(default, deserialize_with = "crate::http::from_str_option")]
773    pub batch_size: Option<i64>,
774    /// Dropout probability for dnn models.
775    pub dropout: Option<f64>,
776    /// Maximum depth of a tree for boosted tree models.
777    pub max_tree_depth: Option<i64>,
778    /// Subsample fraction of the training data to grow tree to prevent overfitting for boosted tree models.
779    pub subsample: Option<f64>,
780    /// Minimum split loss for boosted tree models.
781    pub min_split_loss: Option<f64>,
782    /// Booster type for boosted tree models.
783    pub booster_type: Option<BoosterType>,
784    /// Number of parallel trees constructed during each iteration for boosted tree models.
785    #[serde(default, deserialize_with = "crate::http::from_str_option")]
786    pub num_parallel_tree: Option<i64>,
787    /// Type of normalization algorithm for boosted tree models using dart booster.
788    pub dart_normalize_type: Option<DartNormalizeType>,
789    /// Tree construction algorithm for boosted tree models.
790    pub tree_method: Option<TreeMethod>,
791    /// Minimum sum of instance weight needed in a child for boosted tree models.
792    #[serde(default, deserialize_with = "crate::http::from_str_option")]
793    pub min_tree_child_weight: Option<i64>,
794    /// Subsample ratio of columns when constructing each tree for boosted tree models.
795    pub colsample_bytree: Option<f64>,
796    /// Subsample ratio of columns for each level for boosted tree models.
797    pub colsample_bylevel: Option<f64>,
798    /// Subsample ratio of columns for each node(split) for boosted tree models.
799    pub colsample_bynode: Option<f64>,
800    /// Num factors specified for matrix factorization models.
801    #[serde(default, deserialize_with = "crate::http::from_str_option")]
802    pub num_factors: Option<i64>,
803    /// Feedback type that specifies which algorithm to run for matrix factorization.
804    pub feedback_type: Option<FeedbackType>,
805    /// Hyperparameter for matrix factoration when implicit feedback type is specified.
806    pub wals_alpha: Option<f64>,
807    /// The method used to initialize the centroids for kmeans algorithm.
808    pub kmeans_initialization_method: Option<KmeansInitializationMethod>,
809    /// The column used to provide the initial centroids for kmeans algorithm when kmeansInitializationMethod is CUSTOM.
810    pub kmeans_initialization_column: Option<String>,
811    /// Column to be designated as time series timestamp for ARIMA model.
812    pub time_series_timestamp_column: Option<String>,
813    /// Column to be designated as time series data for ARIMA model.
814    pub time_series_data_column: Option<String>,
815    /// Whether to enable auto ARIMA or not.
816    pub auto_arima: Option<bool>,
817    /// A specification of the non-seasonal part of the ARIMA model: the three components (p, d, q) are the AR order, the degree of differencing, and the MA order.
818    pub non_seasonal_order: Option<ArimaOrder>,
819    /// The data frequency of a time series.
820    pub data_frequency: Option<DataFrequency>,
821    /// Whether or not p-value test should be computed for this model. Only available for linear and logistic regression models.
822    pub calculate_p_values: Option<bool>,
823    /// Include drift when fitting an ARIMA model.
824    pub include_drift: Option<bool>,
825    /// The geographical region based on which the holidays are considered in time series modeling. If a valid value is specified, then holiday effects modeling is enabled.
826    pub holiday_region: Option<HolidayRegion>,
827    /// The time series id column that was used during ARIMA model training.
828    pub time_series_id_column: Option<String>,
829    /// The time series id columns that were used during ARIMA model training.
830    pub time_series_id_columns: Option<Vec<String>>,
831    /// The number of periods ahead that need to be forecasted.
832    #[serde(default, deserialize_with = "crate::http::from_str_option")]
833    pub horizon: Option<i64>,
834    /// Whether to preserve the input structs in output feature names.
835    /// Suppose there is a struct A with field b. When false (default), the output feature name is A_b. When true, the output feature name is A.b.
836    #[serde(skip_serializing_if = "Option::is_none")]
837    pub preserve_input_structs: Option<bool>,
838    /// The max value of the sum of non-seasonal p and q.
839    #[serde(default, deserialize_with = "crate::http::from_str_option")]
840    pub auto_arima_max_order: Option<i64>,
841    /// The min value of the sum of non-seasonal p and q.
842    #[serde(default, deserialize_with = "crate::http::from_str_option")]
843    pub auto_arima_min_order: Option<i64>,
844    /// Number of trials to run this hyperparameter tuning job.
845    #[serde(default, deserialize_with = "crate::http::from_str_option")]
846    pub num_trials: Option<i64>,
847    /// Maximum number of trials to run in parallel.
848    #[serde(default, deserialize_with = "crate::http::from_str_option")]
849    pub max_parallel_trials: Option<i64>,
850    /// The target evaluation metrics to optimize the hyperparameters for.
851    pub hparam_tuning_objectives: Option<Vec<HparamTuningObjective>>,
852    /// If true, perform decompose time series and save the results.
853    pub decompose_time_series: Option<bool>,
854    /// If true, clean spikes and dips in the input time series.
855    pub clean_spikes_and_dips: Option<bool>,
856    /// If true, detect step changes and make data adjustment in the input time series.
857    pub adjust_step_changes: Option<bool>,
858    /// If true, enable global explanation during training.
859    pub enable_global_explain: Option<bool>,
860    /// Number of paths for the sampled Shapley explain method.
861    #[serde(default, deserialize_with = "crate::http::from_str_option")]
862    pub sampled_shapley_num_paths: Option<i64>,
863    /// Number of integral steps for the integrated gradients explain method.
864    #[serde(default, deserialize_with = "crate::http::from_str_option")]
865    pub integrated_gradients_num_steps: Option<i64>,
866}
867
868#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug)]
869#[serde(rename_all = "camelCase")]
870pub enum EvaluationMetrics {
871    /// Populated for regression models and explicit feedback type matrix factorization models.
872    RegressionMetrics(RegressionMetrics),
873    /// Populated for binary classification/classifier models.
874    BinaryClassificationMetrics(BinaryClassificationMetrics),
875    /// Populated for multi-class classification/classifier models.
876    MultiClassClassificationMetrics(MultiClassClassificationMetrics),
877    /// Populated for clustering models.
878    ClusteringMetrics(ClusteringMetrics),
879    /// Populated for implicit feedback type matrix factorization models.
880    RankingMetrics(RankingMetrics),
881    /// Populated for ARIMA models.
882    ArimaForecastingMetrics(ArimaForecastingMetrics),
883    /// Evaluation metrics when the model is a dimensionality reduction model, which currently includes PCA.
884    DimensionalityReductionMetrics(DimensionalityReductionMetrics),
885}
886
887impl Default for EvaluationMetrics {
888    fn default() -> Self {
889        Self::RegressionMetrics(RegressionMetrics::default())
890    }
891}
892
893#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
894#[serde(rename_all = "camelCase")]
895pub struct RegressionMetrics {
896    /// Mean absolute error.
897    pub mean_absolute_error: Option<f64>,
898    /// Mean squared error.
899    pub mean_squared_error: Option<f64>,
900    /// Mean squared log error.
901    pub mean_squared_log_error: Option<f64>,
902    /// Median absolute error.
903    pub median_absolute_error: Option<f64>,
904    /// R^2 score. This corresponds to r2_score in ML.EVALUATE.
905    pub r_squared: Option<f64>,
906}
907
908#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
909#[serde(rename_all = "camelCase")]
910pub struct BinaryClassificationMetrics {
911    /// Aggregate classification metrics.
912    pub aggregate_classification_metrics: Option<AggregateClassificationMetrics>,
913    /// Binary confusion matrix at multiple thresholds.
914    pub binary_confusion_matrix_list: Option<Vec<BinaryConfusionMatrix>>,
915    /// Label representing the positive class.
916    pub positive_label: Option<String>,
917    /// Label representing the negative class.
918    pub negative_label: Option<String>,
919}
920
921#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
922#[serde(rename_all = "camelCase")]
923pub struct AggregateClassificationMetrics {
924    /// Precision is the fraction of actual positive predictions that had positive actual labels.
925    /// For multiclass this is a macro-averaged metric treating each class as a binary classifier.
926    pub precision: Option<f64>,
927    /// Recall is the fraction of actual positive labels that were given a positive prediction.
928    /// For multiclass this is a macro-averaged metric.
929    pub recall: Option<f64>,
930    /// Accuracy is the fraction of predictions given the correct label. For multiclass this is a micro-averaged metric.
931    pub accuracy: Option<f64>,
932    /// Threshold at which the metrics are computed.
933    /// For binary classification models this is the positive class threshold.
934    /// For multi-class classfication models this is the confidence threshold.
935    pub threshold: Option<f64>,
936    /// The F1 score is an average of recall and precision. For multiclass this is a macro-averaged metric.
937    pub f1_score: Option<f64>,
938    /// Logarithmic Loss. For multiclass this is a macro-averaged metric.
939    pub log_loss: Option<f64>,
940    /// Area Under a ROC Curve. For multiclass this is a macro-averaged metric.
941    pub roc_auc: Option<f64>,
942}
943
944#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
945#[serde(rename_all = "camelCase")]
946pub struct BinaryConfusionMatrix {
947    /// Threshold value used when computing each of the following metric.
948    pub positive_class_threshold: Option<f64>,
949    /// Number of true samples predicted as true.
950    #[serde(default, deserialize_with = "crate::http::from_str_option")]
951    pub true_positives: Option<i64>,
952    /// Number of false samples predicted as true.
953    #[serde(default, deserialize_with = "crate::http::from_str_option")]
954    pub false_positives: Option<i64>,
955    /// Number of true samples predicted as false.
956    #[serde(default, deserialize_with = "crate::http::from_str_option")]
957    pub true_negatives: Option<i64>,
958    /// Number of false samples predicted as false.
959    #[serde(default, deserialize_with = "crate::http::from_str_option")]
960    pub false_negatives: Option<i64>,
961    /// The fraction of actual positive predictions that had positive actual labels.
962    pub precision: Option<f64>,
963    /// The fraction of actual positive labels that were given a positive prediction.
964    pub recall: Option<f64>,
965    /// The equally weighted average of recall and precision.
966    pub f1_score: Option<f64>,
967    /// The fraction of predictions given the correct label.
968    pub accuracy: Option<f64>,
969}
970
971#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
972#[serde(rename_all = "camelCase")]
973pub struct MultiClassClassificationMetrics {
974    /// Aggregate classification metrics.
975    pub aggregate_classification_metrics: Option<AggregateClassificationMetrics>,
976    /// Confusion matrix at different thresholds.
977    pub confusion_matrix_list: Option<Vec<ConfusionMatrix>>,
978}
979
980#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
981#[serde(rename_all = "camelCase")]
982pub struct ConfusionMatrix {
983    /// Confidence threshold used when computing the entries of the confusion matrix.
984    pub confidence_threshold: Option<f64>,
985    /// One row per actual label.
986    pub rows: Option<Vec<Row>>,
987}
988
989#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
990#[serde(rename_all = "camelCase")]
991pub struct Row {
992    /// The original label of this row.
993    pub actual_label: Option<String>,
994    /// Info describing predicted label distribution.
995    pub entries: Option<Vec<Entry>>,
996}
997
998#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
999#[serde(rename_all = "camelCase")]
1000pub struct Entry {
1001    /// The predicted label. For confidenceThreshold > 0,
1002    /// we will also add an entry indicating the number of items under the confidence threshold.
1003    pub predicted_label: Option<String>,
1004    /// Number of items being predicted as this label.
1005    #[serde(default, deserialize_with = "crate::http::from_str_option")]
1006    pub item_count: Option<i64>,
1007}
1008
1009#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
1010#[serde(rename_all = "camelCase")]
1011pub struct ClusteringMetrics {
1012    /// Davies-Bouldin index.
1013    pub davies_bouldin_index: Option<f64>,
1014    /// Mean of squared distances between each sample to its cluster centroid.
1015    pub mean_squared_distance: Option<f64>,
1016    /// Information for all clusters.
1017    pub clusters: Option<Vec<Cluster>>,
1018}
1019
1020#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
1021#[serde(rename_all = "camelCase")]
1022pub struct Cluster {
1023    /// Centroid id.
1024    #[serde(default, deserialize_with = "crate::http::from_str_option")]
1025    pub centroid_id: Option<i64>,
1026    /// Values of highly variant features for this cluster.
1027    pub feature_values: Option<Vec<FeatureValue>>,
1028    /// Count of training data rows that were assigned to this cluster.
1029    #[serde(default, deserialize_with = "crate::http::from_str_option")]
1030    pub count: Option<i64>,
1031}
1032
1033#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
1034#[serde(rename_all = "camelCase")]
1035pub struct FeatureValue {
1036    /// The feature column name.
1037    pub feature_column: Option<String>,
1038    #[serde(flatten)]
1039    pub value: FeatureValueType,
1040}
1041
1042#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug)]
1043#[serde(rename_all = "camelCase")]
1044pub enum FeatureValueType {
1045    /// The numerical feature value. This is the centroid value for this feature.
1046    NumericalValue(f64),
1047    /// The categorical feature value.
1048    CategoricalValue(CategoricalValue),
1049}
1050
1051impl Default for FeatureValueType {
1052    fn default() -> Self {
1053        Self::NumericalValue(0.0)
1054    }
1055}
1056
1057#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
1058#[serde(rename_all = "camelCase")]
1059pub struct CategoricalValue {
1060    /// Counts of all categories for the categorical feature.
1061    /// If there are more than ten categories, we return top ten (by count) and return one more
1062    /// CategoryCount with category "_OTHER_" and count as aggregate counts of remaining categories.
1063    pub category_counts: Option<Vec<CategoryCount>>,
1064}
1065
1066#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
1067#[serde(rename_all = "camelCase")]
1068pub struct CategoryCount {
1069    /// The name of category.
1070    pub category: Option<String>,
1071    /// The count of training samples matching the category within the cluster.
1072    #[serde(default, deserialize_with = "crate::http::from_str_option")]
1073    pub count: Option<i64>,
1074}
1075
1076#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
1077#[serde(rename_all = "camelCase")]
1078pub struct RankingMetrics {
1079    /// Calculates a precision per user for all the items by ranking them and then averages all the precisions across all the users.
1080    pub mean_average_precision: Option<f64>,
1081    /// Similar to the mean squared error computed in regression and explicit recommendation models except instead of computing the rating directly, the output from evaluate is computed against a preference which is 1 or 0 depending on if the rating exists or not.
1082    pub mean_squared_error: Option<f64>,
1083    /// A metric to determine the goodness of a ranking calculated from the predicted confidence by comparing it to an ideal rank measured by the original ratings.
1084    pub normalized_discounted_cumulative_gain: Option<f64>,
1085    /// Determines the goodness of a ranking by computing the percentile rank from the predicted confidence and dividing it by the original rank.
1086    pub average_rank: Option<f64>,
1087}
1088
1089#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
1090#[serde(rename_all = "camelCase")]
1091pub struct ArimaForecastingMetrics {
1092    /// Repeated as there can be many metric sets (one for each model) in auto-arima and the large-scale case.
1093    pub arima_single_model_forecasting_metrics: Option<Vec<ArimaSingleModelForecastingMetrics>>,
1094}
1095
1096#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
1097#[serde(rename_all = "camelCase")]
1098pub struct ArimaSingleModelForecastingMetrics {
1099    /// Non-seasonal order.
1100    pub non_seasonal_order: Option<ArimaOrder>,
1101    /// Arima fitting metrics.
1102    pub arima_fitting_metrics: Option<ArimaFittingMetrics>,
1103    /// Is arima model fitted with drift or not. It is always false when d is not 1.
1104    pub has_drift: Option<bool>,
1105    /// The timeSeriesId value for this time series. It will be one of the unique values from the timeSeriesIdColumn specified during ARIMA model training. Only present when timeSeriesIdColumn training option was used.
1106    pub time_series_id: Option<String>,
1107    /// The tuple of timeSeriesIds identifying this time series.
1108    /// It will be one of the unique tuples of values present in the timeSeriesIdColumns specified during ARIMA model training. Only present when timeSeriesIdColumns training option was used and the order of values here are same as the order of timeSeriesIdColumns.
1109    pub time_series_ids: Option<Vec<String>>,
1110    /// Seasonal periods. Repeated because multiple periods are supported for one time series.
1111    pub seasonal_periods: Option<Vec<SeasonalPeriodType>>,
1112    /// If true, holiday_effect is a part of time series decomposition result.
1113    pub has_holiday_effect: Option<bool>,
1114    /// If true, spikes_and_dips is a part of time series decomposition result.
1115    pub has_spikes_and_dips: Option<bool>,
1116    /// If true, step_changes is a part of time series decomposition result.
1117    pub has_step_changes: Option<bool>,
1118}
1119
1120#[derive(Clone, PartialEq, serde::Deserialize, serde::Serialize, Debug, Default)]
1121#[serde(rename_all = "camelCase")]
1122pub struct DimensionalityReductionMetrics {
1123    /// Total percentage of variance explained by the selected principal components.
1124    pub total_explained_variance_ratio: Option<f64>,
1125}