GetModelFeature

更新时间:
复制 MD 格式

Gets detailed information about a model feature, including the selected feature list, lineage relations, and training set export script.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

featurestore:GetModelFeature

get

*全部资源

*

None None

Request syntax

GET /api/v1/instances/{InstanceId}/modelfeatures/{ModelFeatureId} HTTP/1.1

Path Parameters

Parameter

Type

Required

Description

Example

InstanceId

string

Yes

Instance ID, which can be obtained from the ListInstances API.

fs-cn-********

ModelFeatureId

string

Yes

Model feature ID, which can be obtained from the ListModelFeatures API.

3

Request parameters

Parameter

Type

Required

Description

Example

No parameters required.

Response elements

Element

Type

Description

Example

object

Schema of Response

RequestId

string

Request ID.

0C89F5E1-7F24-5EEC-9F05-508A39278CC8

ProjectId

string

Project ID.

5

ProjectName

string

Project name.

project1

Name

string

Model feature name.

model_feature1

Owner

string

Alibaba Cloud account ID of the creator.

1231243253****

GmtCreateTime

string

Creation time.

2023-07-04T14:46:22.227+08:00

GmtModifiedTime

string

Update time.

2023-07-04T14:46:22.227+08:00

LabelTableId

string

Label table ID.

3

LabelTableName

string

Label table name.

label_table1

TrainingSetTable

string

Name of the exported training set table.

table1

TrainingSetFGTable

string

Name of the exported training set FG table.

table2

Features

array<object>

Feature list.

object

Feature.

FeatureViewId

string

Feature view ID.

3

FeatureViewName

string

Feature view name.

feature_view_1

Name

string

Feature name.

feature1

Type

string

Feature type.

● INT32

● INT64

● FLOAT

● DOUBLE

● STRING

● BOOLEAN

● TIMESTAMP

INT32

AliasName

string

Feature alias.

feature2

PrefixName

string

cand_seq__

Relations

object

Feature relations.

Domains

array<object>

Domain list.

object

Id

string

Domain ID。

3

Name

string

The domain name.

feature_entity_1

DomainType

string

The domain type. Valid values:

  • FeatureEntity: feature entity.

  • FeatureView: feature view.

  • ModelFeature: model feature.

FeatureEntity

object

From

string

The source ID of the link.

model_feature_2

To

string

The destination ID of the link.

feature_entity_3

ExportTrainingSetTableScript

string

Script for exporting the training set table.

from feature_store_py.fs_client import FeatureStoreClient\nfrom feature_store_py.fs_project import FeatureStoreProject\nfrom feature_store_py.fs_datasource import LabelInput, MaxComputeDataSource, TrainingSetOutput\nfrom feature_store_py.fs_features import FeatureSelector\nfrom feature_store_py.fs_config import LabelInputConfig, PartitionConfig, FeatureViewConfig\nfrom feature_store_py.fs_config import TrainSetOutputConfig, EASDeployConfig\nimport datetime\nimport sys\n\ncur_day = args['dt']\nprint('cur_day = ', cur_day)\noffset = datetime.timedelta(days=-1)\npre_day = (datetime.datetime.strptime(cur_day, '%Y%m%d') + offset).strftime('%Y%m%d')\nprint('pre_day = ', pre_day)\n\n\naccess_key_id = o.account.access_id\naccess_key_secret = o.account.secret_access_key\nfs = FeatureStoreClient(access_key_id=access_key_id, access_key_secret=access_key_secret, region='cn-beijing')\ncur_project_name = 'p1'\nproject = fs.get_project(cur_project_name)\n\nlabel_partitions = PartitionConfig(name = 'ds', value = cur_day)\nlabel_input_config = LabelInputConfig(partition_config=label_partitions)\n\nfeature_view_1_partitions = PartitionConfig(name = 'ds', value = pre_day)\nfeature_view_1_config = FeatureViewConfig(name = 'user_fea',\npartition_config=feature_view_1_partitions)\n\nfeature_view_2_partitions = PartitionConfig(name = 'ds', value = pre_day)\nfeature_view_2_config = FeatureViewConfig(name = 'seq_fea',\npartition_config=feature_view_2_partitions)\n\nfeature_view_3_partitions = PartitionConfig(name = 'ds', value = pre_day)\nfeature_view_3_config = FeatureViewConfig(name = 'item_fea',\npartition_config=feature_view_3_partitions)\n\nfeature_view_config_list = [feature_view_1_config,feature_view_2_config,feature_view_3_config]\ntrain_set_partitions = PartitionConfig(name = 'ds', value = cur_day)\ntrain_set_output_config = TrainSetOutputConfig(partition_config=train_set_partitions)\n\n\nmodel_name = 'rank_v1'\ncur_model = project.get_model(model_name)\ntask = cur_model.export_train_set(label_input_config, feature_view_config_list, train_set_output_config)\ntask.wait()\nprint('task_summary = ', task.task_summary)\n

LabelPriorityLevel

integer

Label table priority. The default value is 0. Set to 1 to give priority to the label table, or set to 2 to give priority to the feature view.

0

Examples

Success response

JSON format

{
  "RequestId": "0C89F5E1-7F24-5EEC-9F05-508A39278CC8",
  "ProjectId": "5",
  "ProjectName": "project1",
  "Name": "model_feature1",
  "Owner": "1231243253****",
  "GmtCreateTime": "2023-07-04T14:46:22.227+08:00",
  "GmtModifiedTime": "2023-07-04T14:46:22.227+08:00",
  "LabelTableId": "3",
  "LabelTableName": "label_table1",
  "TrainingSetTable": "table1",
  "TrainingSetFGTable": "table2",
  "Features": [
    {
      "FeatureViewId": "3",
      "FeatureViewName": "feature_view_1",
      "Name": "feature1",
      "Type": "INT32",
      "AliasName": "feature2",
      "PrefixName": "cand_seq__"
    }
  ],
  "Relations": {
    "Domains": [
      {
        "Id": "3",
        "Name": "feature_entity_1",
        "DomainType": "FeatureEntity"
      }
    ],
    "Links": [
      {
        "From": "model_feature_2",
        "To": "feature_entity_3",
        "Link": "user_id"
      }
    ]
  },
  "ExportTrainingSetTableScript": "from feature_store_py.fs_client import FeatureStoreClient\\nfrom feature_store_py.fs_project import FeatureStoreProject\\nfrom feature_store_py.fs_datasource import LabelInput, MaxComputeDataSource, TrainingSetOutput\\nfrom feature_store_py.fs_features import FeatureSelector\\nfrom feature_store_py.fs_config import LabelInputConfig, PartitionConfig, FeatureViewConfig\\nfrom feature_store_py.fs_config import TrainSetOutputConfig, EASDeployConfig\\nimport datetime\\nimport sys\\n\\ncur_day = args['dt']\\nprint('cur_day = ', cur_day)\\noffset = datetime.timedelta(days=-1)\\npre_day = (datetime.datetime.strptime(cur_day, '%Y%m%d') + offset).strftime('%Y%m%d')\\nprint('pre_day = ', pre_day)\\n\\n\\naccess_key_id = o.account.access_id\\naccess_key_secret = o.account.secret_access_key\\nfs = FeatureStoreClient(access_key_id=access_key_id, access_key_secret=access_key_secret, region='cn-beijing')\\ncur_project_name = 'p1'\\nproject = fs.get_project(cur_project_name)\\n\\nlabel_partitions = PartitionConfig(name = 'ds', value = cur_day)\\nlabel_input_config = LabelInputConfig(partition_config=label_partitions)\\n\\nfeature_view_1_partitions = PartitionConfig(name = 'ds', value = pre_day)\\nfeature_view_1_config = FeatureViewConfig(name = 'user_fea',\\npartition_config=feature_view_1_partitions)\\n\\nfeature_view_2_partitions = PartitionConfig(name = 'ds', value = pre_day)\\nfeature_view_2_config = FeatureViewConfig(name = 'seq_fea',\\npartition_config=feature_view_2_partitions)\\n\\nfeature_view_3_partitions = PartitionConfig(name = 'ds', value = pre_day)\\nfeature_view_3_config = FeatureViewConfig(name = 'item_fea',\\npartition_config=feature_view_3_partitions)\\n\\nfeature_view_config_list = [feature_view_1_config,feature_view_2_config,feature_view_3_config]\\ntrain_set_partitions = PartitionConfig(name = 'ds', value = cur_day)\\ntrain_set_output_config = TrainSetOutputConfig(partition_config=train_set_partitions)\\n\\n\\nmodel_name = 'rank_v1'\\ncur_model = project.get_model(model_name)\\ntask = cur_model.export_train_set(label_input_config, feature_view_config_list, train_set_output_config)\\ntask.wait()\\nprint('task_summary = ', task.task_summary)\\n",
  "LabelPriorityLevel": 0
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.