View a markdown version of this page

尋找特徵群組中的特徵 - Amazon SageMaker AI

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

尋找特徵群組中的特徵

使用 Amazon SageMaker Feature Store,您可以搜尋在特徵群組中建立的特徵。您可以搜尋所有特徵,而無需先選取特徵群組。搜尋功能可協助尋找與您使用案例相關的特徵。

注意

您要搜尋功能的功能群組必須在 AWS 區域 和 內 AWS 帳戶。對於共用特徵群組,特徵群組必須可供您的 AWS 帳戶探索。如需如何共用特徵群組目錄和授予探索能力的詳細資訊,請參閱共用您的特徵群組目錄

如果您在團隊中,而且團隊成員正在尋找要在其模型中使用的特徵,他們可以搜尋所有特徵群組中的特徵。

您可以新增可搜尋的參數和說明,以使您的特徵更容易被發現。如需詳細資訊,請參閱新增可搜尋的中繼資料至特徵

您可以使用主控台或使用 SageMaker AI 中的 Search API 操作來搜尋特徵。下表列出所有可搜尋的中繼資料,以及您是否可以在主控台中或使用 API 進行搜尋。

可搜尋的中繼資料 API 欄位名稱 是否可在主控台中搜尋?
所有參數 AllParameters
建立時間 CreationTime
Description Description
特徵群組名稱 FeatureGroupName
特徵名稱 FeatureName
特徵類型 FeatureType
上次修改時間 LastModifiedTime
Parameters Parameters.key

如何搜尋您的特徵

透過主控台使用 Feature Store 的指示取決於您是否已啟用 Amazon SageMaker StudioAmazon SageMaker Studio Classic 做為預設體驗。根據您的使用案例選擇下列其中一項指示。

  1. 遵循 啟動 Amazon SageMaker Studio 中的指示開啟 Studio 主控台。

  2. 在左側導覽窗格中,選擇資料以展開下拉式清單。

  3. 從下拉式清單中,選擇 Feature Store

  4. (選用) 若要檢視您的特徵,請選擇我的帳戶。若要檢視共用特徵,請選擇跨帳戶

  5. 特徵目錄索引標籤下,選擇我的帳戶來檢視您的特徵群組。

  6. 特徵目錄索引標籤下,選擇跨帳戶來檢視其他人讓您可探索的特徵群組。在建立者下,您可以檢視資源擁有者帳戶 ID。

  7. 您可以從搜尋下拉式清單中搜尋您的特徵:

    • (選用) 若要篩選搜尋,請選擇搜尋下拉式清單旁邊的篩選條件圖示。您可以使用篩選條件來指定搜尋結果中的參數或日期範圍。如果您搜尋參數,請同時指定其金鑰和值。若要尋找您的特徵,請指定時間範圍或清除 (取消選取) 您不想要查詢的資料欄。

    • 對於共用資源,如果您具有從資源擁有者帳戶授與的適當存取許可,則只能編輯特徵群組中繼資料或特徵定義。僅有探索能力許可將不允許您編輯中繼資料或特徵定義。如需如何授與存取許可的詳細資訊,請參閱 啟用跨帳戶存取權

本節中的程式碼使用 中的 Search操作 適用於 Python (Boto3) 的 AWS SDK 來執行搜尋查詢,以尋找功能群組中的功能。如需要提交查詢的其他語言的相關資訊,請參閱 Amazon SageMaker API 參考中的另請參閱

如需更多特徵存放區範例和資源,請參閱 Amazon SageMaker Feature Store 資源

下列程式碼顯示使用 API 的不同範例搜尋查詢:

# Return all features in your feature groups sagemaker_client.search( Resource="FeatureMetadata", ) # Search for all features that belong to a feature group that contain the "ver" substring sagemaker_client.search( Resource="FeatureMetadata", SearchExpression={ 'Filters': [ { 'Name': 'FeatureGroupName', 'Operator': 'Contains', 'Value': 'ver' }, ] } ) # Search for all features that belong to a feature group that have the EXACT name "airport" sagemaker_client.search( Resource="FeatureMetadata", SearchExpression={ 'Filters': [ { 'Name': 'FeatureGroupName', 'Operator': 'Equals', 'Value': 'airport' }, ] } ) # Search for all features that belong to a feature group that contains the name "ver" AND have a name that contains "wha" AND have a parameter (key or value) that contains "hea" sagemaker_client.search( Resource="FeatureMetadata", SearchExpression={ 'Filters': [ { 'Name': 'FeatureGroupName', 'Operator': 'Contains', 'Value': 'ver' }, { 'Name': 'FeatureName', 'Operator': 'Contains', 'Value': 'wha' }, { 'Name': 'AllParameters', 'Operator': 'Contains', 'Value': 'hea' }, ] } ) # Search for all features that belong to a feature group with substring "ver" in its name OR features that have a name that contain "wha" OR features that have a parameter (key or value) that contains "hea" sagemaker_client.search( Resource="FeatureMetadata", SearchExpression={ 'Filters': [ { 'Name': 'FeatureGroupName', 'Operator': 'Contains', 'Value': 'ver' }, { 'Name': 'FeatureName', 'Operator': 'Contains', 'Value': 'wha' }, { 'Name': 'AllParameters', 'Operator': 'Contains', 'Value': 'hea' }, ], 'Operator': 'Or' # note that this is explicitly set to "Or"- the default is "And" } ) # Search for all features that belong to a feature group with substring "ver" in its name OR features that have a name that contain "wha" OR parameters with the value 'Sage' for the 'org' key sagemaker_client.search( Resource="FeatureMetadata", SearchExpression={ 'Filters': [ { 'Name': 'FeatureGroupName', 'Operator': 'Contains', 'Value': 'ver' }, { 'Name': 'FeatureName', 'Operator': 'Contains', 'Value': 'wha' }, { 'Name': 'Parameters.org', 'Operator': 'Contains', 'Value': 'Sage' }, ], 'Operator': 'Or' # note that this is explicitly set to "Or"- the default is "And" } )