Define and publish features

You create and publish features inside a project workspace.

screenshot of feature store workspace file changes

Workspace environment prerequisites

To use the feature store in a workspace, the execution must run in an environment with the required Python packages installed. The following environments have the required packages installed:

  • Domino Standard Environment

  • Domino Spark Environment

  • Domino FUSE Environment

  • Domino Dask Environment

  • Domino RAY Environment

If you are using a custom environment and the required packages are not installed there, you can add these to the Dockerfile instructions:

RUN pip install --user feast[snowflake,aws,gcp,redis]==0.33.1
RUN pip install --user dominodatalab-data=={x.y.z}
Important
You must replace the placeholder {x.y.z} with the compatible version of your Domino deployment. Refer to all released packages.

For additional details about how to customize an environment, see the following page on how to Use Dockerfile instructions.

Create a feature view

To define a feature, you create a Feast-specific entity called a feature view, which is a semantic grouping of features.

To create your feature view, define it in a Python file and save it inside the feature_repo folder of the centralized Git repository. This is an example of a feature view:

# NOTE: This is not a runnable code snippet. Please refer to the links below for more guidance.
driver_stats_fv = FeatureView(
    name="driver_stats_fv",
    ttl=Duration(seconds=86400 * 2),
    entities=["driver_id"],
    features=[
        Feature(name="conv_rate", dtype=ValueType.FLOAT),
        Feature(name="acc_rate", dtype=ValueType.FLOAT),
        Feature(name="avg_daily_trips", dtype=ValueType.FLOAT)
    ],
    batch_source=file_source
)

For more guidance on creating feature views, see the quickstart guide and Feast’s feature view documentation and code examples.

Publish a feature

To make a feature available globally within the Domino feature store, you can publish it.

  1. Under File Changes, click Pull to pull any updates into your local workspace and resolve any merge conflicts.

    screenshot of feature store workspace side buttons

  2. Click Review & Publish Features and select the feature view files that you want to push to the centralized Git repository.

  3. Click Sync & Publish Features.

    screenshot of feature store sync & publish features

The result is as follows:

  • The selected files are pushed into the Git repository.

  • The feature views are synced to the Feast repository (meaning that feast apply runs, registering the feature views into the registry.db file generated within the data folder).

  • The feature views are updated in the Domino global registry.

Now you can see your feature at Data > Feature Store, inside your project or globally.

Note
You need to pull the feature store Git repository to get the latest changes after publishing features.

Troubleshooting

The syncing performed above is executed through a script that runs as a job. In the case of errors, an error toast is displayed and the failed job details are included in the job logs. Common causes of errors include Git credential issues, offline store credential problems, and Feast code problems.

  • To check for errors in your Feast code, open a terminal, change the current directory to the mounted Feast git repository folder, and run the feast apply command. If the error is related to Feast code, you’ll see a stack trace to help you debug. Address the error and click the Review & Publish Features button in the workspace to publish the changes.

  • For other issues, navigate to the project feature store page and rerun the job by clicking the link in the banner at the top of the page. This banner only appears if the last sync job failed.

  • For credential issues:

    • Update your Git credentials in Account Settings > Git Credentials.

    • Update your offline and online store credentials in Account Settings > User Environment Variables.

Syncs (including rerun syncs) always run on the most updated version of the code available in the Domino feature store.

Next steps