在 Feature Store 中查找特征组 - Amazon SageMaker
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

在 Feature Store 中查找特征组

通过 Amazon F SageMaker eature Store,您可以使用控制台或搜索操作来搜索功能组。您可以使用搜索功能来查找与您要创建的模型相关的特征和特征组。您可以使用搜索功能快速查找与您的使用案例相关的特征组。

注意

您要搜索的功能组必须位于您的 Amazon Web Services 区域 和 Amazon 帐户中,或者与您共享并允许您 Amazon Web Services 账户发现。有关如何共享功能组目录和授予可发现性的更多信息,请参阅共享特征组目录

下表显示了可搜索的字段以及您是否可以使用控制台搜索特定字段。

您可以使用 Amazon SageMaker Studio Classic 或 SageMaker API 中的Search操作来搜索功能。下表列出了所有可搜索的元数据以及您是否可以在控制台中搜索这些元数据。对于您自己的特征组,标签可以搜索;但对于您可以发现的特征组,则不可搜索。

可搜索元数据 API 字段名称 可以在控制台中搜索吗? 是否可以跨账户搜索?
所有标签 AllTags 不支持
创建失败原因 FailureReason
创建状态 FeatureGroup状态
创建时间 CreationTime
描述 Description
事件时间特征名称 EventTimeFeatureName
特征定义 FeatureDefinitions
特征组 ARN FeatureGroupARN
特征组名称 FeatureGroup姓名
离线存储配置 OfflineStoreConfig
离线存储状态 OfflineStore状态
上次更新状态 LastUpdate状态
记录标识符特征名称 RecordIdentifierFeatureName
标签 Tags.key 不支持

如何查找功能组

您可以使用控制台或 Amazon F SageMaker eature Store API 来查找您的功能组。通过控制台使用 Feature Store 的说明取决于您是否已启用亚马逊 SageMaker Studio亚马逊 SageMaker Studio 经典版将其作为默认体验。

  1. 按照中的说明打开 Studio 控制台启动亚马逊 SageMaker Studio

  2. 在左侧导航窗格中选择 “数据” 以展开下拉列表。

  3. 从下拉列表中,选择 Feature Store

  4. (可选)要查看您的功能组,请选择我的帐户。要查看共享功能组,请选择跨账户

  5. 功能组目录选项卡下,选择我的帐户以查看您的功能组。

  6. 功能组目录选项卡下,选择跨账户查看其他人允许你发现的功能组。在 “创建者” 下,您可以查看资源所有者账户 ID。

  7. 您可以在 “搜索” 下拉列表中搜索您的功能组:

    • (可选)要筛选您的搜索,请选择 “搜索” 下拉列表旁边的筛选器图标。可以使用筛选器在搜索结果中指定参数或日期范围。如果要搜索参数,请同时指定其键和值。要查找您的功能组,您可以指定时间范围、清除(取消选择)不想查询的列、选择要搜索的商店或按状态进行搜索。

    • 对于共享资源,只有拥有资源所有者账户授予的适当访问权限后,您才能编辑功能组元数据或要素定义。仅凭可发现性权限不允许您编辑元数据或要素定义。有关授予访问权限的更多信息,请参阅启用跨账户访问

本节中的代码使用中的Search Amazon SDK for Python (Boto3) 操作运行搜索查询来查找功能组。有关提交查询的其他语言的信息,请参Amazon SageMaker API 参考中的另请参阅

有关更多功能商店示例和资源,请参阅Amazon SageMaker 功能商店资源

以下代码显示了使用 API 的不同搜索查询示例:

# Return all feature groups sagemaker_client.search( Resource="FeatureGroups", ) # Search for feature groups that are shared with your account sagemaker_session.search( resource="FeatureGroup", search_expression={ "Filters": [ { "Name": "FeatureGroupName", "Value": "MyFeatureGroup", "Operator": "Contains", } ], "Operator": "And", }, sort_by="Name", sort_order="Ascending", next_token="token", max_results=50, CrossAccountFilterOption="SameAccount" ) # Search for all feature groups with a name that contains the "ver" substring sagemaker_client.search( Resource="FeatureGroups", SearchExpression={ 'Filters': [ { 'Name': 'FeatureGroupName', 'Operator': 'Contains', 'Value': 'ver' }, ] } ) # Search for all feature groups that have the EXACT name "airport" sagemaker_client.search( Resource="FeatureGroups", SearchExpression={ 'Filters': [ { 'Name': 'FeatureGroupName', 'Operator': 'Equals', 'Value': 'airport' }, ] } ) # Search for all feature groups that contains the name "ver" # AND have a record identifier feature name that contains "wha" # AND have a tag (key or value) that contains "hea" sagemaker_client.search( Resource="FeatureGroups", SearchExpression={ 'Filters': [ { 'Name': 'FeatureGroupName', 'Operator': 'Contains', 'Value': 'ver' }, { 'Name': 'RecordIdentifierFeatureName', 'Operator': 'Contains', 'Value': 'wha' }, { 'Name': 'AllTags', 'Operator': 'Contains', 'Value': 'hea' }, ] } ) # Search for all feature groups with substring "ver" in its name # OR feature groups that have a record identifier feature name that contains "wha" # OR feature groups that have a tag (key or value) that contains "hea" sagemaker_client.search( Resource="FeatureGroups", SearchExpression={ 'Filters': [ { 'Name': 'FeatureGroupName', 'Operator': 'Contains', 'Value': 'ver' }, { 'Name': 'RecordIdentifierFeatureName', 'Operator': 'Contains', 'Value': 'wha' }, { 'Name': 'AllTags', 'Operator': 'Contains', 'Value': 'hea' }, ], 'Operator': 'Or' # note that this is explicitly set to "Or"- the default is "And" } ) # Search for all feature groups with substring "ver" in its name # OR feature groups that have a record identifier feature name that contains "wha" # OR tags with the value 'Sage' for the 'org' key sagemaker_client.search( Resource="FeatureGroups", SearchExpression={ 'Filters': [ { 'Name': 'FeatureGroupName', 'Operator': 'Contains', 'Value': 'ver' }, { 'Name': 'RecordIdentifierFeatureName', 'Operator': 'Contains', 'Value': 'wha' }, { 'Name': 'Tags.org', 'Operator': 'Contains', 'Value': 'Sage' }, ], 'Operator': 'Or' # note that this is explicitly set to "Or"- the default is "And" } ) # Search for all offline only feature groups sagemaker_client.search( Resource="FeatureGroups", SearchExpression={ 'Filters': [ { 'Name': 'OnlineStoreConfig.EnableOnlineStore', 'Operator': 'NotEquals', 'Value': 'true' }, { 'Name': 'OfflineStoreConfig.S3StorageConfig.S3Uri', 'Operator': 'Exists' } ] } ) # Search for all online only feature groups sagemaker_client.search( Resource="FeatureGroups", SearchExpression={ 'Filters': [ { 'Name': 'OnlineStoreConfig.EnableOnlineStore', 'Operator': 'Equals', 'Value': 'true' }, { 'Name': 'OfflineStoreConfig.S3StorageConfig.S3Uri', 'Operator': 'NotExists' } ] } ) # Search for all feature groups that are BOTH online and offline sagemaker_client.search( Resource="FeatureGroups", SearchExpression={ 'Filters': [ { 'Name': 'OnlineStoreConfig.EnableOnlineStore', 'Operator': 'Equals', 'Value': 'true' }, { 'Name': 'OfflineStoreConfig.S3StorageConfig.S3Uri', 'Operator': 'Exists' } ] } )

你也可以使用 Amazon RAM API 的 python SDK 来创建资源共享。API 签名如下所示。要使用 Amazon RAM API 的 python SDK,你需要附加带有执行角色的 Amazon RAM 完全访问托管策略。

response = client.create_resource_share( name='string', resourceArns=[ 'string', ], principals=[ 'string', ], tags=[ { 'key': 'string', 'value': 'string' }, ], allowExternalPrincipals=True|False, clientToken='string', permissionArns=[ 'string', ] )