Back to the Index

Feature Vector

What is a feature vector?

A feature vector is a row of feature values. A training sample for a model includes a feature vector and the label(s). In inference pipelines, a feature vector in the input to a model that returns a prediction. In online inference pipelines, we use the entity_id ( primary key) to return a feature vector of precomputed features for the model. The returned feature vector may be joined with on-demand features to produce the final (encoded) feature vector used by the model to make a prediction.

Examples of feature vectors 

Let's consider a dataset of houses with two features, the size of the house in square feet and the number of bedrooms, and a label, the price of the house. A feature vector for a specific house might look like:

 # house-id '1': 1500 square ft, 3 bedrooms, price $1m
row = [1, 1500, 3, 1000000]  

# the features from the above row are
feature_vector = [1500, 3] 

Using a feature store like Hopsworks, in online inference pipelines, you can use retrieve a feature vector of precomputed features for an entity_id using the feature view’s get_feature_vector method:

 feature_view = fs.get_feature_view("house_prices", version=1)

# Retrieve the feature vector using the entity_id (primary key)
entry = {"house_id": 1}
feature_vector = feature_view.get_feature_vector(entry)
Does this content look outdated? If you are interested in helping us maintain this, feel free to contact us.

© Hopsworks 2023. All rights reserved. Various trademarks held by their respective owners.

Privacy Policy
Cookie Policy
Terms and Conditions