google.cloud.bigquery.model.Model¶
- class google.cloud.bigquery.model.Model(model_ref: Optional[Union[google.cloud.bigquery.model.ModelReference, str]])[source]¶
Model represents a machine learning model resource.
See https://cloud.google.com/bigquery/docs/reference/rest/v2/models
- Parameters
model_ref – A pointer to a model. If
model_ref
is a string, it must included a project ID, dataset ID, and model ID, each separated by.
.
- __init__(model_ref: Optional[Union[google.cloud.bigquery.model.ModelReference, str]])[source]¶
Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
(model_ref)Initialize self.
from_api_repr
(resource)Factory: construct a model resource given its API representation
Construct the API resource representation of this model.
Attributes
The best trial_id across all training runs.
Datetime at which the model was created (
None
until set from the server).ID of dataset containing the model.
Description of the model (defaults to
None
).Custom encryption configuration for the model.
ETag for the model resource (
None
until set from the server).The datetime when this model expires.
Input feature columns that were used to train this model.
Title of the table (defaults to
None
).Label columns that were used to train this model.
Labels for the table.
The geographic location where the model resides.
The model ID.
Type of the model resource.
Datetime at which the model was last modified (
None
until set from the server).URL path for the model’s APIs.
Project bound to the model.
A model reference pointing to this model.
Information for all training runs in increasing order of start time.
The input feature columns that were used to train this model.
- property best_trial_id: Optional[int]¶
The best trial_id across all training runs.
Deprecated since version This: property is deprecated!
Read-only.
- property created: Optional[datetime.datetime]¶
Datetime at which the model was created (
None
until set from the server).Read-only.
- property dataset_id: Optional[str]¶
ID of dataset containing the model.
- property encryption_configuration: Optional[google.cloud.bigquery.encryption_configuration.EncryptionConfiguration]¶
Custom encryption configuration for the model.
Custom encryption configuration (e.g., Cloud KMS keys) or
None
if using default encryption.See protecting data with Cloud KMS keys in the BigQuery documentation.
- property etag: Optional[str]¶
ETag for the model resource (
None
until set from the server).Read-only.
- property expires: Optional[datetime.datetime]¶
The datetime when this model expires.
If not present, the model will persist indefinitely. Expired models will be deleted and their storage reclaimed.
- property feature_columns: Sequence[google.cloud.bigquery.standard_sql.StandardSqlField]¶
Input feature columns that were used to train this model.
Read-only.
- classmethod from_api_repr(resource: Dict[str, Any]) → google.cloud.bigquery.model.Model[source]¶
Factory: construct a model resource given its API representation
- Parameters
resource – Model resource representation from the API
- Returns
Model parsed from
resource
.
- property label_columns: Sequence[google.cloud.bigquery.standard_sql.StandardSqlField]¶
Label columns that were used to train this model.
The output of the model will have a
predicted_
prefix to these columns.Read-only.
- property labels: Dict[str, str]¶
Labels for the table.
This method always returns a dict. To change a model’s labels, modify the dict, then call
Client.update_model
. To delete a label, set its value toNone
before updating.
- property location: Optional[str]¶
The geographic location where the model resides.
This value is inherited from the dataset.
Read-only.
- property model_id: Optional[str]¶
The model ID.
- property model_type: str¶
Type of the model resource.
Read-only.
- property modified: Optional[datetime.datetime]¶
Datetime at which the model was last modified (
None
until set from the server).Read-only.
- property path: Optional[str]¶
URL path for the model’s APIs.
- property project: Optional[str]¶
Project bound to the model.
- property reference: Optional[google.cloud.bigquery.model.ModelReference]¶
A model reference pointing to this model.
Read-only.
- to_api_repr() → Dict[str, Any][source]¶
Construct the API resource representation of this model.
- Returns
Model reference represented as an API resource
- property training_runs: Sequence[Dict[str, Any]]¶
Information for all training runs in increasing order of start time.
Dictionaries are in REST API format. See: https://cloud.google.com/bigquery/docs/reference/rest/v2/models#trainingrun
Read-only.
- property transform_columns: Sequence[google.cloud.bigquery.model.TransformColumn]¶
The input feature columns that were used to train this model. The output transform columns used to train this model.
See REST API: https://cloud.google.com/bigquery/docs/reference/rest/v2/models#transformcolumn
Read-only.