Learn how to manage and find features.
Create a feature
Create a single feature for an existing entity type. To create multiple features in a single request, see Batch creating features.
Web UI
- In the Vertex AI section of the Google Cloud console, go to the Features page.
- Select a region from the Region drop-down list.
- In the features table, view the Entity type column and click the entity type to add features to.
- Click Add features to open the Add features pane.
- Specify a name, value type, and (optionally) a description for the feature.
- To enable feature value monitoring (Preview), under Feature monitoring, select Override entity type monitoring config and then enter the number of days between snapshots. This configuration overrides any existing or future monitoring configurations on the feature's entity type. For more information, see Feature value monitoring.
- To add more features, click Add another feature.
- Click Save.
REST
To create a feature for an existing entity type, send a POST request by using the featurestores.entityTypes.features.create method.
Before using any of the request data, make the following replacements:
- LOCATION_ID: Region where the featurestore is located, such as
us-central1
. - PROJECT_ID: Your project ID.
- FEATURESTORE_ID: ID of the featurestore.
- ENTITY_TYPE_ID: ID of the entity type.
- FEATURE_ID: An ID for the feature.
- DESCRIPTION: Description of the feature.
- VALUE_TYPE: The value type of the feature.
HTTP method and URL:
POST https://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE_ID?featureId=FEATURE_ID
Request JSON body:
{ "description": "DESCRIPTION", "valueType": "VALUE_TYPE" }
To send your request, choose one of these options:
curl
Save the request body in a file named request.json
,
and execute the following command:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE_ID?featureId=FEATURE_ID"
PowerShell
Save the request body in a file named request.json
,
and execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE_ID?featureId=FEATURE_ID" | Select-Object -Expand Content
You should see output similar to the following. You can use the OPERATION_ID in the response to get the status of the operation.
{ "name": "projects/PROJECT_NUMBER/locations/LOCATION_ID/featurestores/FEATURESTORE_ID/operations/OPERATION_ID", "metadata": { "@type": "type.googleapis.com/google.cloud.aiplatform.v1.CreateFeatureOperationMetadata", "genericMetadata": { "createTime": "2021-03-02T00:04:13.039166Z", "updateTime": "2021-03-02T00:04:13.039166Z" } } }
Vertex AI SDK for Python
To learn how to install or update the Vertex AI SDK for Python, see Install the Vertex AI SDK for Python. For more information, see the Vertex AI SDK for Python API reference documentation.
Python
The client library for Vertex AI is included when you install the Vertex AI SDK for Python. To learn how to install the Vertex AI SDK for Python, see Install the Vertex AI SDK for Python. For more information, see the Vertex AI SDK for Python API reference documentation.
Java
Before trying this sample, follow the Java setup instructions in the Vertex AI quickstart using client libraries. For more information, see the Vertex AI Java API reference documentation.
To authenticate to Vertex AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Node.js
Before trying this sample, follow the Node.js setup instructions in the Vertex AI quickstart using client libraries. For more information, see the Vertex AI Node.js API reference documentation.
To authenticate to Vertex AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Batch create features
Create features in bulk for an existing type. For batch creation requests,
Vertex AI Feature Store (Legacy) creates multiple features at once, which is faster
for creating a large number of features compared to the
featurestores.entityTypes.features.create
method.
Web UI
See creating a feature.
REST
To create one or more features for an existing entity type, send a POST request by using the featurestores.entityTypes.features.batchCreate method, as shown in the following sample.
Before using any of the request data, make the following replacements:
- LOCATION_ID: Region where the featurestore is located, such as
us-central1
. - PROJECT_ID: Your project ID.
- FEATURESTORE_ID: ID of the featurestore.
- ENTITY_TYPE_ID: ID of the entity type.
- PARENT: The resource name of the entity type to create the features under.
Required format:
projects/PROJECT_ID/locations/LOCATION_ID/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE_ID
- FEATURE_ID: An ID for the feature.
- DESCRIPTION: Description of the feature.
- VALUE_TYPE: The value type of the feature.
- DURATION: (Optional) The interval duration between snapshots in seconds. The value must end with an `s`.
HTTP method and URL:
POST https://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE_ID/features:batchCreate
Request JSON body:
{ "requests": [ { "parent" : "PARENT_1", "feature": { "description": "DESCRIPTION_1", "valueType": "VALUE_TYPE_1", "monitoringConfig": { "snapshotAnalysis": { "monitoringInterval": "DURATION" } } }, "featureId": "FEATURE_ID_1" }, { "parent" : "PARENT_2", "feature": { "description": "DESCRIPTION_2", "valueType": "VALUE_TYPE_2", "monitoringConfig": { "snapshotAnalysis": { "monitoringInterval": "DURATION" } } }, "featureId": "FEATURE_ID_2" } ] }
To send your request, choose one of these options:
curl
Save the request body in a file named request.json
,
and execute the following command:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE_ID/features:batchCreate"
PowerShell
Save the request body in a file named request.json
,
and execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE_ID/features:batchCreate" | Select-Object -Expand Content
You should see output similar to the following. You can use the OPERATION_ID in the response to get the status of the operation.
{ "name": "projects/PROJECT_NUMBER/locations/LOCATION_ID/featurestores/FEATURESTORE_ID/operations/OPERATION_ID", "metadata": { "@type": "type.googleapis.com/google.cloud.aiplatform.v1.BatchCreateFeaturesOperationMetadata", "genericMetadata": { "createTime": "2021-03-02T00:04:13.039166Z", "updateTime": "2021-03-02T00:04:13.039166Z" } } }
Vertex AI SDK for Python
To learn how to install or update the Vertex AI SDK for Python, see Install the Vertex AI SDK for Python. For more information, see the Vertex AI SDK for Python API reference documentation.
Python
The client library for Vertex AI is included when you install the Vertex AI SDK for Python. To learn how to install the Vertex AI SDK for Python, see Install the Vertex AI SDK for Python. For more information, see the Vertex AI SDK for Python API reference documentation.
Java
Before trying this sample, follow the Java setup instructions in the Vertex AI quickstart using client libraries. For more information, see the Vertex AI Java API reference documentation.
To authenticate to Vertex AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Node.js
Before trying this sample, follow the Node.js setup instructions in the Vertex AI quickstart using client libraries. For more information, see the Vertex AI Node.js API reference documentation.
To authenticate to Vertex AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
List features
List all features in a given location. To search for features across all entity types and featurestores in a given location, see the Searching for features method.
Web UI
- In the Vertex AI section of the Google Cloud console, go to the Features page.
- Select a region from the Region drop-down list.
- In the features table, view the Features column to see the features in your project for the selected region.
REST
To list all features for a single entity type, send a GET request by using the featurestores.entityTypes.features.list method.
Before using any of the request data, make the following replacements:
- LOCATION_ID: Region where the featurestore is located, such as
us-central1
. - PROJECT_ID: Your project ID.
- FEATURESTORE_ID: ID of the featurestore.
- ENTITY_TYPE_ID: ID of the entity type.
HTTP method and URL:
GET https://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE_ID/features
To send your request, choose one of these options:
curl
Execute the following command:
curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE_ID/features"
PowerShell
Execute the following command:
$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/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE_ID/features" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "features": [ { "name": "projects/PROJECT_NUMBER/locations/LOCATION_ID/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE_ID/features/FEATURE_ID_1", "description": "DESCRIPTION", "valueType": "VALUE_TYPE", "createTime": "2021-03-01T22:41:20.626644Z", "updateTime": "2021-03-01T22:41:20.626644Z", "labels": { "environment": "testing" }, "etag": "AMEw9yP0qJeLao6P3fl9cKEGY4ie5-SanQaiN7c_Ca4QOa0u7AxwO6i75Vbp0Cr51MSf" }, { "name": "projects/PROJECT_NUMBER/locations/LOCATION_ID/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE_ID/features/FEATURE_ID_2", "description": "DESCRIPTION", "valueType": "VALUE_TYPE", "createTime": "2021-02-25T01:27:00.544230Z", "updateTime": "2021-02-25T01:27:00.544230Z", "labels": { "environment": "testing" }, "etag": "AMEw9yMdrLZ7Waty0ane-DkHq4kcsIVC-piqJq7n6A_Y-BjNzPY4rNlokDHNyUqC7edw" }, { "name": "projects/PROJECT_NUMBER/locations/LOCATION_ID/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE_ID/features/FEATURE_ID_3", "description": "DESCRIPTION", "valueType": "VALUE_TYPE", "createTime": "2021-03-01T22:41:20.628493Z", "updateTime": "2021-03-01T22:41:20.628493Z", "labels": { "environment": "testing" }, "etag": "AMEw9yM-sAkv-u-jzkUOToaAVovK7GKbrubd9DbmAonik-ojTWG8-hfSRYt6jHKRTQ35" } ] }
Java
Before trying this sample, follow the Java setup instructions in the Vertex AI quickstart using client libraries. For more information, see the Vertex AI Java API reference documentation.
To authenticate to Vertex AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Node.js
Before trying this sample, follow the Node.js setup instructions in the Vertex AI quickstart using client libraries. For more information, see the Vertex AI Node.js API reference documentation.
To authenticate to Vertex AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Additional languages
T