Reference documentation and code samples for the BigQuery Client class Model.
A BigQuery ML Model represents what an ML system has learned from the training data.
Namespace
Google \ Cloud \ BigQueryMethods
__construct
connection
Google\Cloud\BigQuery\Connection\ConnectionInterface
Represents a connection to BigQuery.
id
string
The model's ID.
datasetId
string
The dataset's ID.
projectId
string
The project's ID.
info
array
[optional] The model data.
location
array
[optional] The location of the model.
info
Retrieves the model's details. If no model data is cached, a network request will be made to retrieve it.
Please note that Model instances created by list calls may not contain a full representation of the model resource. To obtain a full resource on a Model instance, call Google\Cloud\BigQuery\Model::reload() .
Example:
$info = $model->info();
echo $info['modelType'];
options
array
[optional] Configuration options.
array
reload
Triggers a network request to reload the model's details.
Example:
$model->reload();
$info = $model->info();
echo $info['modelType'];
options
array
[optional] Configuration options.
array
id
Retrieves the model's ID.
Example:
echo $model->id();
string
identity
Retrieves the model's identity.
An identity provides a description of a resource that is nested in nature.
Example:
echo $model->identity()['modelId'];
array
delete
Delete the model.
Please note that by default the library will not attempt to retry this call on your behalf.
Example:
$model->delete();
options
array
[optional] Configuration options.
exists
Check whether or not the model exists.
Example:
echo $model->exists();
options
array
[optional] Configuration options.
bool
update
Update the model.
Providing an etag
key as part of $metadata
will enable simultaneous
update protection. This is useful in preventing override of modifications
made by another user. The resource's current etag can be obtained via a
GET request on the resource.
Please note that by default this call will not automatically retry on
your behalf unless an etag
is set.
Example:
$model->update([
'friendlyName' => 'My ML model'
]);
metadata
options
array
[optional] Configuration options.
array
extract
Returns an extract job configuration to be passed to either BigQueryClient::runJob() or BigQueryClient::startJob() . A configuration can be built using fluent setters or by providing a full set of options at once.
Example:
$destinationObject = $storage->bucket('myBucket')->object('modelOutput');
$extractJobConfig = $model->extract($destinationObject);
destination
string| Google\Cloud\Storage\StorageObject
The destination object. May be
a Google\Cloud\Storage\StorageObject
or a URI pointing to
a Google Cloud Storage object in the format of gs://{bucket-name}/{object-name}
.
options
array
[optional] Please see the upstream API documentation for Job configuration for the available options.