AutoML表API模型训练不起作用

问题描述

我创建了一个数据集并在automl表上,我想训练模型,但是我在文档中看不到 tableId columnId 在文档的任何地方,我都能找到这些参数的定义。 请问如何通过API创建和训练模型?

const automl = require('@google-cloud/automl');
const client = new automl.v1beta1.AutoMlClient();

/**
 * Demonstrates using the AutoML client to create a model.
 * Todo(developer): Uncomment the following lines before running the sample.
 */
// const projectId = '[PROJECT_ID]' e.g.,"my-gcloud-project";
// const computeRegion = '[REGION_NAME]' e.g.,"us-central1";
// const datasetId = '[DATASET_ID]' e.g.,"TBL2246891593778855936";
// const tableId = '[TABLE_ID]' e.g.,"1991013247762825216";
// const columnId = '[COLUMN_ID]' e.g.,"773141392279994368";
// const modelName = '[MODEL_NAME]' e.g.,"testModel";
// const trainBudget = '[TRAIN_BUDGET]' e.g.,"1000",// `Train budget in milli node hours`;

// A resource that represents Google Cloud Platform location.
const projectLocation = client.locationPath(projectId,computeRegion);

// Get the full path of the column.
const columnSpecId = client.columnSpecPath(
  projectId,computeRegion,datasetId,tableId,columnId
);

// Set target column to train the model.
const targetColumnSpec = {name: columnSpecId};

// Set tables model Metadata.
const tablesModelMetadata = {
  targetColumnSpec: targetColumnSpec,trainBudgetMilliNodeHours: trainBudget,};

// Set datasetId,model name and model Metadata for the dataset.
const myModel = {
  datasetId: datasetId,displayName: modelName,tablesModelMetadata: tablesModelMetadata,};

// Create a model with the model Metadata in the region.
client
  .createModel({parent: projectLocation,model: myModel})
  .then(responses => {
    const initialApiResponse = responses[1];
    console.log(`Training operation name: ${initialApiResponse.name}`);
    console.log('Training started...');
  })
  .catch(err => {
    console.error(err);
  });

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)