Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(automl): expose disable_early_stopping option for create_model #9779

Merged
merged 1 commit into from
Nov 12, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion automl/google/cloud/automl_v1beta1/tables/tables_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2106,9 +2106,10 @@ def create_model(
optimization_objective=None,
project=None,
region=None,
model_metadata={},
model_metadata=None,
include_column_spec_names=None,
exclude_column_spec_names=None,
disable_early_stopping=False,
**kwargs
):
"""Create a model. This will train your model on the given dataset.
Expand Down Expand Up @@ -2168,6 +2169,10 @@ def create_model(
exclude_column_spec_names(Optional[str]):
The list of the names of the columns you want to exclude and
not train your model on.
disable_early_stopping(Optional[bool]):
True if disable early stopping. By default, the early stopping
feature is enabled, which means that AutoML Tables might stop
training before the entire training budget has been used.
Returns:
google.api_core.operation.Operation:
An operation future that can be used to check for
Expand All @@ -2180,6 +2185,9 @@ def create_model(
to a retryable error and retry attempts failed.
ValueError: If required parameters are missing.
"""
if model_metadata is None:
model_metadata = {}

if (
train_budget_milli_node_hours is None
or train_budget_milli_node_hours < 1000
Expand Down Expand Up @@ -2212,6 +2220,8 @@ def create_model(
model_metadata["train_budget_milli_node_hours"] = train_budget_milli_node_hours
if optimization_objective is not None:
model_metadata["optimization_objective"] = optimization_objective
if disable_early_stopping:
model_metadata["disable_early_stopping"] = True

dataset_id = dataset_name.rsplit("/", 1)[-1]
columns = [
Expand Down