Model objects are returned by methods such as and .
Package
@google-cloud/bigquery
Example
const {BigQuery} = require('@google-cloud/bigquery');
const bigquery = new BigQuery();
const dataset = bigquery.dataset('my-dataset');
const model = dataset.model('my-model');
Constructors
(constructor)(dataset, id)
constructor(dataset: Dataset, id: string);
Constructs a new instance of the Model
class
Parameters |
---|
Name | Description |
dataset |
Dataset
|
id |
string
|
Properties
bigQuery
dataset
Methods
createExtractJob(destination: string | File, options?: CreateExtractJobOptions): Promise<JobResponse>;
Example
const {BigQuery} = require('@google-cloud/bigquery');
const bigquery = new BigQuery();
const dataset = bigquery.dataset('my-dataset');
const model = dataset.model('my-model');
const extractedModel = 'gs://my-bucket/extracted-model';
function callback(err, job, apiResponse) {
// `job` is a Job object that can be used to check the status of the
// request.
}
//-
// To use the default options, just pass a string or a {@link
https://googleapis.dev/nodejs/storage/latest/File.html File}
object.
//
// Note: The default format is 'ML_TF_SAVED_MODEL'.
//-
model.createExtractJob(extractedModel, callback);
//-
// If you need more customization, pass an `options` object.
//-
const options = {
format: 'ML_TF_SAVED_MODEL',
jobId: '123abc'
};
model.createExtractJob(extractedModel, options, callback);
//-
// If the callback is omitted, we'll return a Promise.
//-
model.createExtractJob(extractedModel, options).then((data) => {
const job = data[0];
const apiResponse = data[1];
});
createExtractJob(destination: string | File, options: CreateExtractJobOptions, callback: JobCallback): void;
Returns |
---|
Type | Description |
void | |
createExtractJob(destination: string | File, callback: JobCallback): void;
Returns |
---|
Type | Description |
void | |
extract(destination: string | File, options?: CreateExtractJobOptions): Promise<JobMetadataResponse>;
Export model to Cloud Storage.
Example
const {BigQuery} = require('@google-cloud/bigquery');
const bigquery = new BigQuery();
const dataset = bigquery.dataset('my-dataset');
const model = dataset.model('my-model');
const extractedModel = 'gs://my-bucket/extracted-model';
//-
function callback(err, job, apiResponse) {
// `job` is a Job object that can be used to check the status of the
// request.
}
//-
// To use the default options, just pass a string or a {@link
https://googleapis.dev/nodejs/storage/latest/File.html File}
object.
//
// Note: The default format is 'ML_TF_SAVED_MODEL'.
//-
model.createExtractJob(extractedModel, callback);
//-
// If you need more customization, pass an `options` object.
//-
const options = {
format: 'ML_TF_SAVED_MODEL',
jobId: '123abc'
};
model.createExtractJob(extractedModel, options, callback);
//-
// If the callback is omitted, we'll return a Promise.
//-
model.createExtractJob(extractedModel, options).then((data) => {
const job = data[0];
const apiResponse = data[1];
});
extract(destination: string | File, options: CreateExtractJobOptions, callback?: JobMetadataCallback): void;
Returns |
---|
Type | Description |
void | |
extract(destination: string | File, callback?: JobMetadataCallback): void;
Returns |
---|
Type | Description |
void | |