列出特徵

您可以擷取Google Cloud 專案中特定功能群組新增的功能清單。每個特徵都對應至 BigQuery 來源資料表或檢視表中特定資料欄所含的特徵值,並與特徵群組建立關聯。

事前準備

向 Vertex AI 進行驗證 (如果尚未完成)。

Select the tab for how you plan to use the samples on this page:

Console

When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.

REST

如要在本機開發環境中使用本頁的 REST API 範例,請使用您提供給 gcloud CLI 的憑證。

    After installing the Google Cloud CLI, initialize it by running the following command:

    gcloud init

    If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

詳情請參閱 Google Cloud 驗證說明文件中的「Authenticate for using REST」。

列出特徵群組中的特徵

使用下列範例,擷取特徵群組中的特徵清單。

控制台

按照下列操作說明,使用 Google Cloud 控制台查看特徵群組中的特徵清單。

  1. 在 Google Cloud 控制台的 Vertex AI 專區中,前往「Feature Store」頁面。

    前往 Feature Store 頁面

  2. 在「功能群組」部分中,按一下功能群組名稱旁邊的展開圖示,即可查看其中的所有功能。

REST

如要擷取專案中特定功能群組內的所有 Feature 資源清單,請使用 features.list 方法傳送 GET 要求。

使用任何要求資料之前,請先替換以下項目:

  • LOCATION_ID:Featuregroup 所在的區域,例如 us-central1
  • PROJECT_ID:您的專案 ID。
  • FEATURE_GROUP_NAME:要查看特徵清單的特徵群組名稱。

HTTP 方法和網址:

GET https://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featureGroups/FEATURE_GROUP_NAME/features

如要傳送要求,請選擇以下其中一個選項:

curl

執行下列指令:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featureGroups/FEATURE_GROUP_NAME/features"

PowerShell

執行下列指令:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featureGroups/FEATURE_GROUP_NAME/features" | Select-Object -Expand Content

您應該會收到如下的 JSON 回應:

{
  "features": [
    {
      "name": "projects/PROJECT_NUMBER/locations/LOCATION_ID/featureGroups/FEATURE_GROUP_NAME/features/FEATURE_NAME_1",
      "createTime": "2023-09-06T23:16:00.429055Z",
      "updateTime": "2023-09-06T23:16:00.429055Z",
      "etag": "AMEw9yP4QWrXwty9C5J9a77O3_yV5LW4DUIIagKpmoHdzctF577OtlBlOyZC7EIQUZ8_",
      "versionColumnName": "double"
    },
    {
      "name": "projects/PROJECT_NUMBER/locations/LOCATION_ID/featureGroups/FEATURE_GROUP_NAME/features/FEATURE_NAME_2",
      "createTime": "2023-09-07T00:59:39.330881Z",
      "updateTime": "2023-09-07T00:59:39.330881Z",
      "etag": "AMEw9yOZhegkDL44AMibnanMoDNJeVx-MHwcOqAQuihGHWFQxJMpvG3ePH3bNDS-tIRX",
      "versionColumnName": "double2"
    }
  ]
}

後續步驟