@@ -591,10 +591,10 @@ def update_column_spec(self, dataset=None, dataset_display_name=None,
591
591
If you have initialized the client with a value for `region` it
592
592
will be used if this parameter is not supplied.
593
593
column_spec_name (Optional[string]):
594
- The name AutoML-assigned name for the column you want to
594
+ The name AutoML-assigned name for the column you want to
595
595
update.
596
596
column_spec_display_name (Optional[string]):
597
- The human-readable name of the column you want to update. If
597
+ The human-readable name of the column you want to update. If
598
598
this is supplied in place of `column_spec_name`, you also
599
599
need to provide either a way to lookup the source dataset
600
600
(using one of the `dataset*` kwargs), or the `table_spec_name`
@@ -607,19 +607,19 @@ def update_column_spec(self, dataset=None, dataset_display_name=None,
607
607
If no `table_spec_name` was provided, we use this index to
608
608
determine which table to update column specs on.
609
609
dataset_display_name (Optional[string]):
610
- The human-readable name given to the dataset you want to update
610
+ The human-readable name given to the dataset you want to update
611
611
specs on. If no `table_spec_name` is supplied, this will
612
612
be used together with `table_spec_index` to infer the name of
613
613
table to update specs on. This must be supplied if `table_spec_name`,
614
614
`dataset` or `dataset_name` are not supplied.
615
615
dataset_name (Optional[string]):
616
- The AutoML-assigned name given to the dataset you want to update
616
+ The AutoML-assigned name given to the dataset you want to update
617
617
specs one. If no `table_spec_name` is supplied, this will
618
618
be used together with `table_spec_index` to infer the name of
619
619
table to update specs on. This must be supplied if `table_spec_name`,
620
620
`dataset` or `dataset_display_name` are not supplied.
621
621
dataset (Optional[Dataset]):
622
- The `Dataset` instance you want to update
622
+ The `Dataset` instance you want to update
623
623
specs on. If no `table_spec_name` is supplied, this will
624
624
be used together with `table_spec_index` to infer the name of
625
625
table to update specs on. This must be supplied if `table_spec_name`,
@@ -699,7 +699,7 @@ def set_target_column(self, dataset=None, dataset_display_name=None,
699
699
If you have initialized the client with a value for `region` it
700
700
will be used if this parameter is not supplied.
701
701
column_spec_name (Optional[string]):
702
- The name AutoML-assigned name for the column you want to
702
+ The name AutoML-assigned name for the column you want to
703
703
set as the target column.
704
704
column_spec_display_name (Optional[string]):
705
705
The human-readable name of the column you want to set as the
@@ -802,7 +802,7 @@ def set_weight_column(self, dataset=None, dataset_display_name=None,
802
802
If you have initialized the client with a value for `region` it
803
803
will be used if this parameter is not supplied.
804
804
column_spec_name (Optional[string]):
805
- The name AutoML-assigned name for the column you want to
805
+ The name AutoML-assigned name for the column you want to
806
806
set as the weight column.
807
807
column_spec_display_name (Optional[string]):
808
808
The human-readable name of the column you want to set as the
@@ -879,6 +879,44 @@ def set_weight_column(self, dataset=None, dataset_display_name=None,
879
879
return self .client .update_dataset (request )
880
880
881
881
def list_models (self , project = None , region = None ):
882
+ """List all models in a particular project and region.
883
+
884
+ Example:
885
+ >>> from google.cloud import automl_v1beta1
886
+ >>>
887
+ >>> client = automl_v1beta1.tables.ClientHelper(
888
+ ... client=automl_v1beta1.AutoMlClient(),
889
+ ... project='my-project', region='us-central1')
890
+ >>>
891
+ >>> ms = client.list_models()
892
+ >>>
893
+ >>> for m in ms:
894
+ ... # do something
895
+ ... pass
896
+
897
+ Args:
898
+ project (Optional[string]):
899
+ If you have initialized the client with a value for `project`
900
+ it will be used if this parameter is not supplied. Keep in
901
+ mind, the service account this client was initialized with must
902
+ have access to this project.
903
+ region (Optional[string]):
904
+ If you have initialized the client with a value for `region` it
905
+ will be used if this parameter is not supplied.
906
+
907
+ Returns:
908
+ A :class:`~google.api_core.page_iterator.PageIterator` instance.
909
+ An iterable of :class:`~google.cloud.automl_v1beta1.types.Model`
910
+ instances. You can also iterate over the pages of the response
911
+ using its `pages` property.
912
+
913
+ Raises:
914
+ google.api_core.exceptions.GoogleAPICallError: If the request
915
+ failed for any reason.
916
+ google.api_core.exceptions.RetryError: If the request failed due
917
+ to a retryable error and retry attempts failed.
918
+ ValueError: If required parameters are missing.
919
+ """
882
920
return self .client .list_models (
883
921
self .__location_path (project = project , region = region )
884
922
)
@@ -887,6 +925,55 @@ def create_model(self, model_display_name, dataset=None,
887
925
dataset_display_name = None , dataset_name = None ,
888
926
train_budget_milli_node_hours = None , project = None ,
889
927
region = None ):
928
+ """Create a model. This will train your model on the given dataset.
929
+
930
+ Example:
931
+ >>> from google.cloud import automl_v1beta1
932
+ >>>
933
+ >>> client = automl_v1beta1.tables.ClientHelper(
934
+ ... client=automl_v1beta1.AutoMlClient(),
935
+ ... project='my-project', region='us-central1')
936
+ >>>
937
+ >>> d = client.create_model('my_model', dataset_display_name='my_dataset')
938
+
939
+ Args:
940
+ project (Optional[string]):
941
+ If you have initialized the client with a value for `project`
942
+ it will be used if this parameter is not supplied. Keep in
943
+ mind, the service account this client was initialized with must
944
+ have access to this project.
945
+ region (Optional[string]):
946
+ If you have initialized the client with a value for `region` it
947
+ will be used if this parameter is not supplied.
948
+ model_display_name (string):
949
+ a human-readable name to refer to this model by.
950
+ train_budget_milli_node_hours (int):
951
+ The amount of time (in thousandths of an hour) to spend
952
+ training. This value must be between 1,000 and 72,000 inclusive
953
+ (between 1 and 72 hours).
954
+ dataset_display_name (Optional[string]):
955
+ The human-readable name given to the dataset you want to train
956
+ your model on. This must be supplied if `dataset` or
957
+ `dataset_name` are not supplied.
958
+ dataset_name (Optional[string]):
959
+ The AutoML-assigned name given to the dataset you want to train
960
+ your model on. This must be supplied if `dataset_display_name`
961
+ or `dataset` are not supplied.
962
+ dataset (Optional[Dataset]):
963
+ The `Dataset` instance you want to train your model on. This
964
+ must be supplied if `dataset_display_name` or `dataset_name`
965
+ are not supplied.
966
+
967
+ Returns:
968
+ A :class:`~google.cloud.automl_v1beta1.types.Dataset` instance.
969
+
970
+ Raises:
971
+ google.api_core.exceptions.GoogleAPICallError: If the request
972
+ failed for any reason.
973
+ google.api_core.exceptions.RetryError: If the request failed due
974
+ to a retryable error and retry attempts failed.
975
+ ValueError: If required parameters are missing.
976
+ """
890
977
if train_budget_milli_node_hours is None :
891
978
raise ValueError ('\' train_budget_milli_node_hours\' must be a '
892
979
'value between 1,000 and 72,000 inclusive' )
@@ -930,6 +1017,7 @@ def get_model(self, project=None, region=None,
930
1017
return next (m for m in self .list_models (project , region )
931
1018
if m .name == model_name
932
1019
or m .display_name == model_display_name )
1020
+
933
1021
#TODO(jonathanskim): allow deployment from just model ID
934
1022
def deploy_model (self , model = None , model_name = None ,
935
1023
model_display_name = None , project = None , region = None ):
0 commit comments