Skip to content

Commit 79918bb

Browse files
author
Helin Wang
committed
feat(automl): expose disable_early_stopping option for create_model
Disable early stopping is turned off by default. It's defined in proto here: https://github.com/googleapis/google-cloud-python/blob/bfb4da8542981d2eedffe20f64e87ab528a17592/automl/google/cloud/automl_v1beta1/proto/tables.proto#L196 This PR exposes disable_early_stopping option for TablesClient.create_model.
1 parent 0c5405f commit 79918bb

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

automl/google/cloud/automl_v1beta1/tables/tables_client.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2109,6 +2109,7 @@ def create_model(
21092109
model_metadata={},
21102110
include_column_spec_names=None,
21112111
exclude_column_spec_names=None,
2112+
disable_early_stopping=False,
21122113
**kwargs
21132114
):
21142115
"""Create a model. This will train your model on the given dataset.
@@ -2168,6 +2169,10 @@ def create_model(
21682169
exclude_column_spec_names(Optional[str]):
21692170
The list of the names of the columns you want to exclude and
21702171
not train your model on.
2172+
disable_early_stopping(Optional[bool]):
2173+
True if disable early stopping. By default, the early stopping
2174+
feature is enabled, which means that AutoML Tables might stop
2175+
training before the entire training budget has been used.
21712176
Returns:
21722177
google.api_core.operation.Operation:
21732178
An operation future that can be used to check for
@@ -2212,6 +2217,8 @@ def create_model(
22122217
model_metadata["train_budget_milli_node_hours"] = train_budget_milli_node_hours
22132218
if optimization_objective is not None:
22142219
model_metadata["optimization_objective"] = optimization_objective
2220+
if disable_early_stopping:
2221+
model_metadata["disable_early_stopping"] = True
22152222

22162223
dataset_id = dataset_name.rsplit("/", 1)[-1]
22172224
columns = [

0 commit comments

Comments
 (0)