# Class TrainingOptions (3.42.1)

3.42.1 (latest) 3.42.0 3.41.0 3.40.1 3.39.0 3.38.0 3.37.0 3.36.0 3.35.1 3.34.0 3.33.0 3.31.0 3.30.0 3.29.0 3.27.0 3.26.0 3.25.0 3.24.0 3.23.1 3.22.0 3.21.0 3.20.1 3.19.0 3.18.0 3.17.2 3.16.0 3.15.0 3.14.1 3.13.0 3.12.0 3.11.4 3.4.0 3.3.6 3.2.0 3.1.0 3.0.1 2.34.4 2.33.0 2.32.0 2.31.0 2.30.1 2.29.0 2.28.1 2.27.1 2.26.0 2.25.2 2.24.1 2.23.3 2.22.1 2.21.0 2.20.0 2.19.0 2.18.0 2.17.0 2.16.1 2.15.0 2.14.0 2.13.1 2.12.0 2.11.0 2.10.0 2.9.0 2.8.0 2.7.0 2.6.2 2.5.0 2.4.0 2.3.1 2.2.0 2.1.0 2.0.0 1.28.2 1.27.2 1.26.1 1.25.0 1.24.0 1.23.1 1.22.0 1.21.0 1.20.0 1.19.0 1.18.0 1.17.0 1.16.0

    TrainingOptions(mapping=None, *, ignore_unknown_fields=False, **kwargs)

Options used in model training.

| ## Attributes ||
|---|---|
| **Name** | **Description** |
| `max_iterations` | `int` The maximum number of iterations in training. Used only for iterative training algorithms. |
| `loss_type` | `https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery_v2.types.Model.LossType` Type of loss function used during training run. |
| `learn_rate` | `float` Learning rate in training. Used only for iterative training algorithms. |
| `l1_regularization` | `google.protobuf.wrappers_pb2.DoubleValue` L1 regularization coefficient. |
| `l2_regularization` | `google.protobuf.wrappers_pb2.DoubleValue` L2 regularization coefficient. |
| `min_relative_progress` | `google.protobuf.wrappers_pb2.DoubleValue` When early_stop is true, stops training when accuracy improvement is less than 'min_relative_progress'. Used only for iterative training algorithms. |
| `warm_start` | `google.protobuf.wrappers_pb2.BoolValue` Whether to train a model from the last checkpoint. |
| `early_stop` | `google.protobuf.wrappers_pb2.BoolValue` Whether to stop early when the loss doesn't improve significantly any more (compared to min_relative_progress). Used only for iterative training algorithms. |
| `input_label_columns` | `Sequence[str]` Name of input label columns in training data. |
| `data_split_method` | `https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery_v2.types.Model.DataSplitMethod` The data split type for training and evaluation, e.g. RANDOM. |
| `data_split_eval_fraction` | `float` The fraction of evaluation data over the whole input data. 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. |
| `data_split_column` | `str` The column to split data with. This column won't be used as a feature. 1. When data_split_method is CUSTOM, the corresponding column should be boolean. The rows with true value tag are eval data, and the false are training data. 2. When data_split_method is SEQ, the first DATA_SPLIT_EVAL_FRACTION rows (from smallest to largest) in the corresponding column are used as training data, and the rest are eval data. It respects the order in Orderable data types: https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#data-type-properties |
| `learn_rate_strategy` | `https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery_v2.types.Model.LearnRateStrategy` The strategy to determine learn rate for the current iteration. |
| `initial_learn_rate` | `float` Specifies the initial learning rate for the line search learn rate strategy. |
| `label_class_weights` | `Mapping[str, float]` Weights associated with each label class, for rebalancing the training data. Only applicable for classification models. |
| `user_column` | `str` User column specified for matrix factorization models. |
| `item_column` | `str` Item column specified for matrix factorization models. |
| `distance_type` | `https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery_v2.types.Model.DistanceType` Distance type for clustering models. |
| `num_clusters` | `int` Number of clusters for clustering models. |
| `model_uri` | `str` Google Cloud Storage URI from which the model was imported. Only applicable for imported models. |
| `optimization_strategy` | `https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery_v2.types.Model.OptimizationStrategy` Optimization strategy for training linear regression models. |
| `hidden_units` | `Sequence[int]` Hidden units for dnn models. |
| `batch_size` | `int` Batch size for dnn models. |
| `dropout` | `google.protobuf.wrappers_pb2.DoubleValue` Dropout probability for dnn models. |
| `max_tree_depth` | `int` Maximum depth of a tree for boosted tree models. |
| `subsample` | `float` Subsample fraction of the training data to grow tree to prevent overfitting for boosted tree models. |
| `min_split_loss` | `google.protobuf.wrappers_pb2.DoubleValue` Minimum split loss for boosted tree models. |
| `num_factors` | `int` Num factors specified for matrix factorization models. |
| `feedback_type` | `https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery_v2.types.Model.FeedbackType` Feedback type that specifies which algorithm to run for matrix factorization. |
| `wals_alpha` | `google.protobuf.wrappers_pb2.DoubleValue` Hyperparameter for matrix factoration when implicit feedback type is specified. |
| `kmeans_initialization_method` | `https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery_v2.types.Model.KmeansEnums.KmeansInitializationMethod` The method used to initialize the centroids for kmeans algorithm. |
| `kmeans_initialization_column` | `str` The column used to provide the initial centroids for kmeans algorithm when kmeans_initialization_method is CUSTOM. |
| `time_series_timestamp_column` | `str` Column to be designated as time series timestamp for ARIMA model. |
| `time_series_data_column` | `str` Column to be designated as time series data for ARIMA model. |
| `auto_arima` | `bool` Whether to enable auto ARIMA or not. |
| `non_seasonal_order` | `https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery_v2.types.Model.ArimaOrder` 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. |
| `data_frequency` | `https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery_v2.types.Model.DataFrequency` The data frequency of a time series. |
| `include_drift` | `bool` Include drift when fitting an ARIMA model. |
| `holiday_region` | `https://docs.cloud.google.com/python/docs/reference/bigquery/latest/google.cloud.bigquery_v2.types.Model.HolidayRegion` 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. |
| `time_series_id_column` | `str` The time series id column that was used during ARIMA model training. |
| `time_series_id_columns` | `Sequence[str]` The time series id columns that were used during ARIMA model training. |
| `horizon` | `int` The number of periods ahead that need to be forecasted. |
| `preserve_input_structs` | `bool` Whether to preserve the input structs in output feature names. 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. |
| `auto_arima_max_order` | `int` The max value of non-seasonal p and q. |
| `decompose_time_series` | `google.protobuf.wrappers_pb2.BoolValue` If true, perform decompose time series and save the results. |
| `clean_spikes_and_dips` | `google.protobuf.wrappers_pb2.BoolValue` If true, clean spikes and dips in the input time series. |
| `adjust_step_changes` | `google.protobuf.wrappers_pb2.BoolValue` If true, detect step changes and make data adjustment in the input time series. |

## Classes

### LabelClassWeightsEntry

    LabelClassWeightsEntry(mapping=None, *, ignore_unknown_fields=False, **kwargs)

The abstract base class for a message.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `kwargs` | `dict` Keys and values corresponding to the fields of the message. |
| `mapping` | ``Union[dict, `.Message`]`` A dictionary or message to be used to determine the values for this message. |
| `ignore_unknown_fields` | `Optional(bool)` If True, do not raise errors for unknown fields. Only applied if `mapping` is a mapping type or there are keyword parameters. |