13. Create Feature List
Create a feature list¶
A feature list is an essential component in machine learning, comprising a collection of features that are used to train models. Let's compile a feature list using some of the features we've created.
In [1]:
Copied!
import featurebyte as fb
# Set your profile to the tutorial environment
fb.use_profile("tutorial")
catalog_name = "Grocery Dataset SDK Tutorial"
catalog = fb.Catalog.activate(catalog_name)
import featurebyte as fb
# Set your profile to the tutorial environment
fb.use_profile("tutorial")
catalog_name = "Grocery Dataset SDK Tutorial"
catalog = fb.Catalog.activate(catalog_name)
17:50:26 | INFO | SDK version: 3.3.1 17:50:26 | INFO | No catalog activated. 17:50:26 | INFO | Using profile: tutorial 17:50:26 | INFO | Using configuration file at: /Users/gxav/.featurebyte/config.yaml 17:50:26 | INFO | Active profile: tutorial (https://tutorials.featurebyte.com/api/v1) 17:50:27 | INFO | SDK version: 3.3.1 17:50:27 | INFO | No catalog activated. 17:50:27 | INFO | Catalog activated: Grocery Dataset SDK Tutorial 16:11:44 | INFO | Active profile: tutorial (https://tutorials.featurebyte.com/api/v1) 16:11:44 | WARNING | Remote SDK version (1.1.0.dev7) is different from local (1.1.0.dev1). Update local SDK to avoid unexpected behavior. 16:11:44 | INFO | No catalog activated. 16:11:44 | INFO | Catalog activated: Grocery Dataset Tutorial
List all features we created so far¶
In [2]:
Copied!
catalog.list_features()
catalog.list_features()
Out[2]:
| id | name | dtype | readiness | online_enabled | tables | primary_tables | entities | primary_entities | created_at | |
|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 693159012aa58fbff341f3f0 | CUSTOMER_Mean_vector_of_item_product_ProductGr... | FLOAT | DRAFT | False | [GROCERYINVOICE, INVOICEITEMS, GROCERYPRODUCT] | [GROCERYINVOICE, INVOICEITEMS] | [customer] | [customer] | 2025-12-04T09:50:02.683000 |
| 1 | 693158ca6569366adbcc0540 | CUSTOMER_vs_OVERALL_item_TotalCost_across_prod... | FLOAT | DRAFT | False | [GROCERYINVOICE, INVOICEITEMS, GROCERYPRODUCT] | [INVOICEITEMS] | [customer] | [customer] | 2025-12-04T09:48:03.895000 |
| 2 | 693158aaff830029b6b420cc | CUSTOMER_Latest_invoice_Amount_Z_Score_to_invo... | FLOAT | DRAFT | False | [GROCERYINVOICE] | [GROCERYINVOICE] | [customer] | [customer] | 2025-12-04T09:47:27.658000 |
| 3 | 6931587c0a733a4262914a0e | CUSTOMER_Std_of_invoice_Amount_28d | FLOAT | DRAFT | False | [GROCERYINVOICE] | [GROCERYINVOICE] | [customer] | [customer] | 2025-12-04T09:46:58.849000 |
| 4 | 6931587c0a733a4262914a0d | CUSTOMER_Std_of_invoice_Amount_14d | FLOAT | DRAFT | False | [GROCERYINVOICE] | [GROCERYINVOICE] | [customer] | [customer] | 2025-12-04T09:46:58.559000 |
| 5 | 6931587c0a733a4262914a0c | CUSTOMER_Avg_of_invoice_Amount_28d | FLOAT | DRAFT | False | [GROCERYINVOICE] | [GROCERYINVOICE] | [customer] | [customer] | 2025-12-04T09:46:58.271000 |
| 6 | 6931587c0a733a4262914a0b | CUSTOMER_Avg_of_invoice_Amount_14d | FLOAT | DRAFT | False | [GROCERYINVOICE] | [GROCERYINVOICE] | [customer] | [customer] | 2025-12-04T09:46:57.981000 |
| 7 | 6931587c0a733a4262914a0a | CUSTOMER_Count_of_invoice_28d | INT | DRAFT | False | [GROCERYINVOICE] | [GROCERYINVOICE] | [customer] | [customer] | 2025-12-04T09:46:57.708000 |
| 8 | 6931587c0a733a4262914a09 | CUSTOMER_Count_of_invoice_14d | INT | DRAFT | False | [GROCERYINVOICE] | [GROCERYINVOICE] | [customer] | [customer] | 2025-12-04T09:46:57.500000 |
| 9 | 6931587c0a733a4262914a08 | CUSTOMER_Latest_invoice_Amount | FLOAT | DRAFT | False | [GROCERYINVOICE] | [GROCERYINVOICE] | [customer] | [customer] | 2025-12-04T09:46:57.273000 |
| 10 | 6931587c0a733a4262914a04 | CUSTOMER_x_PRODUCTGROUP_Sum_of_item_TotalCost_28d | FLOAT | DRAFT | False | [GROCERYINVOICE, INVOICEITEMS, GROCERYPRODUCT] | [INVOICEITEMS] | [customer, productgroup] | [customer, productgroup] | 2025-12-04T09:46:56.985000 |
| 11 | 6931587c0a733a4262914a03 | CUSTOMER_x_PRODUCTGROUP_Sum_of_item_TotalCost_14d | FLOAT | DRAFT | False | [GROCERYINVOICE, INVOICEITEMS, GROCERYPRODUCT] | [INVOICEITEMS] | [customer, productgroup] | [customer, productgroup] | 2025-12-04T09:46:56.632000 |
| 12 | 6931587c0a733a4262914a07 | CUSTOMER_x_PRODUCTGROUP_Time_Since_Latest_Time... | FLOAT | DRAFT | False | [GROCERYINVOICE, INVOICEITEMS, GROCERYPRODUCT] | [INVOICEITEMS] | [customer, productgroup] | [customer, productgroup] | 2025-12-04T09:46:56.316000 |
| 13 | 6931585f0b7384835aa4879a | CUSTOMER_Age_band | VARCHAR | DRAFT | False | [GROCERYCUSTOMER] | [GROCERYCUSTOMER] | [customer] | [customer] | 2025-12-04T09:46:19.490000 |
| 14 | 6931585f0b7384835aa48790 | CUSTOMER_Age | INT | DRAFT | False | [GROCERYCUSTOMER] | [GROCERYCUSTOMER] | [customer] | [customer] | 2025-12-04T09:46:12.777000 |
Get features from catalog¶
In [3]:
Copied!
customer_age_band = catalog.get_feature("CUSTOMER_Age_band")
customer_latest_invoice_amount = catalog.get_feature("CUSTOMER_Latest_invoice_Amount")
customer_count_of_invoice_14d = catalog.get_feature("CUSTOMER_Count_of_invoice_14d")
customer_avg_of_invoice_amount_14d = catalog.get_feature("CUSTOMER_Avg_of_invoice_Amount_14d")
customer_std_of_invoice_amount_14d = catalog.get_feature("CUSTOMER_Std_of_invoice_Amount_14d")
customer_latest_invoice_amount_Z_score_to_invoice_amount_28d = catalog.get_feature(
"CUSTOMER_Latest_invoice_Amount_Z_Score_to_invoice_Amount_28d"
)
customer_vs_overall_item_totalcost_across_product_productgroups_26w = catalog.get_feature(
"CUSTOMER_vs_OVERALL_item_TotalCost_across_product_ProductGroups_26w"
)
customer_x_productgroup_sum_of_item_totalcost_14d = \
catalog.get_feature("CUSTOMER_x_PRODUCTGROUP_Sum_of_item_TotalCost_14d")
customer_x_productgroup_time_since_latest_timestamp = \
catalog.get_feature("CUSTOMER_x_PRODUCTGROUP_Time_Since_Latest_Timestamp")
customer_age_band = catalog.get_feature("CUSTOMER_Age_band")
customer_latest_invoice_amount = catalog.get_feature("CUSTOMER_Latest_invoice_Amount")
customer_count_of_invoice_14d = catalog.get_feature("CUSTOMER_Count_of_invoice_14d")
customer_avg_of_invoice_amount_14d = catalog.get_feature("CUSTOMER_Avg_of_invoice_Amount_14d")
customer_std_of_invoice_amount_14d = catalog.get_feature("CUSTOMER_Std_of_invoice_Amount_14d")
customer_latest_invoice_amount_Z_score_to_invoice_amount_28d = catalog.get_feature(
"CUSTOMER_Latest_invoice_Amount_Z_Score_to_invoice_Amount_28d"
)
customer_vs_overall_item_totalcost_across_product_productgroups_26w = catalog.get_feature(
"CUSTOMER_vs_OVERALL_item_TotalCost_across_product_ProductGroups_26w"
)
customer_x_productgroup_sum_of_item_totalcost_14d = \
catalog.get_feature("CUSTOMER_x_PRODUCTGROUP_Sum_of_item_TotalCost_14d")
customer_x_productgroup_time_since_latest_timestamp = \
catalog.get_feature("CUSTOMER_x_PRODUCTGROUP_Time_Since_Latest_Timestamp")
Create feature list¶
In [4]:
Copied!
simple_feature_list = fb.FeatureList(
[
customer_age_band,
customer_latest_invoice_amount,
customer_count_of_invoice_14d,
customer_avg_of_invoice_amount_14d,
customer_std_of_invoice_amount_14d,
customer_latest_invoice_amount_Z_score_to_invoice_amount_28d,
customer_vs_overall_item_totalcost_across_product_productgroups_26w,
customer_x_productgroup_sum_of_item_totalcost_14d,
customer_x_productgroup_time_since_latest_timestamp,
],
name="Customer x ProductGroup Simple FeatureList",
)
simple_feature_list = fb.FeatureList(
[
customer_age_band,
customer_latest_invoice_amount,
customer_count_of_invoice_14d,
customer_avg_of_invoice_amount_14d,
customer_std_of_invoice_amount_14d,
customer_latest_invoice_amount_Z_score_to_invoice_amount_28d,
customer_vs_overall_item_totalcost_across_product_productgroups_26w,
customer_x_productgroup_sum_of_item_totalcost_14d,
customer_x_productgroup_time_since_latest_timestamp,
],
name="Customer x ProductGroup Simple FeatureList",
)
Preview feature list¶
In [5]:
Copied!
# Check the primary entity of the feature list
simple_feature_list.primary_entity
# Check the primary entity of the feature list
simple_feature_list.primary_entity
Out[5]:
[<featurebyte.api.entity.Entity at 0x107635210>
{
'name': 'customer',
'created_at': '2025-12-04T09:42:26.412000',
'updated_at': '2025-12-04T09:42:31.346000',
'description': None,
'serving_names': [
'GROCERYCUSTOMERGUID'
],
'catalog_name': 'Grocery Dataset SDK Tutorial'
},
<featurebyte.api.entity.Entity at 0x108cfe6b0>
{
'name': 'productgroup',
'created_at': '2025-12-04T09:42:27.759000',
'updated_at': '2025-12-04T09:42:32.773000',
'description': None,
'serving_names': [
'PRODUCTGROUP'
],
'catalog_name': 'Grocery Dataset SDK Tutorial'
}]
In [6]:
Copied!
# Get observation table: 'Preview Table with 10 items'
preview_table = catalog.get_observation_table("Preview Table with 10 items")
# Get observation table: 'Preview Table with 10 items'
preview_table = catalog.get_observation_table("Preview Table with 10 items")
In [7]:
Copied!
# Preview simple_feature_list
simple_feature_list.preview(preview_table)
# Preview simple_feature_list
simple_feature_list.preview(preview_table)
Out[7]:
| POINT_IN_TIME | GROCERYINVOICEITEMGUID | CUSTOMER_Age_band | CUSTOMER_Latest_invoice_Amount | CUSTOMER_Count_of_invoice_14d | CUSTOMER_Avg_of_invoice_Amount_14d | CUSTOMER_Std_of_invoice_Amount_14d | CUSTOMER_Latest_invoice_Amount_Z_Score_to_invoice_Amount_28d | CUSTOMER_vs_OVERALL_item_TotalCost_across_product_ProductGroups_26w | CUSTOMER_x_PRODUCTGROUP_Sum_of_item_TotalCost_14d | CUSTOMER_x_PRODUCTGROUP_Time_Since_Latest_Timestamp | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 2023-06-26 15:05:25 | a3ac8a5e-8d9b-40b4-a835-38ccce024110 | 45-49 | 57.87 | NaN | NaN | NaN | NaN | 0.487491 | NaN | 677.198056 |
| 1 | 2023-03-24 09:58:13 | 9c7bb568-3237-4115-8e4b-ad1e2855299a | 35-39 | 22.72 | 4.0 | 11.340000 | 8.430590 | 1.193831 | 0.740781 | 2.99 | 125.022500 |
| 2 | 2022-07-26 09:12:59 | 75c6652a-fb95-4d36-aad1-e9a38ad2e4b0 | 65-69 | 20.72 | 4.0 | 18.685000 | 10.511343 | 0.009317 | 0.774532 | NaN | 360.957222 |
| 3 | 2022-09-30 17:39:57 | a4a2b3f5-69fb-403b-8868-bc360b500add | 75-79 | 2.99 | 5.0 | 7.066000 | 3.461009 | -1.247233 | 0.746415 | NaN | 2111.837778 |
| 4 | 2023-06-14 08:04:37 | 7b7b5ae1-4a84-449b-88f0-37bd54bc5c2c | 60-64 | 40.54 | 2.0 | 26.695000 | 13.845000 | 1.179506 | 0.486674 | NaN | 767.908333 |
| 5 | 2023-03-27 14:11:18 | f0f67ecc-38a0-4ddf-99a4-a3d531b00aa9 | 50-54 | 7.15 | 2.0 | 14.805000 | 7.655000 | -1.799405 | 0.805892 | 10.00 | 286.953333 |
| 6 | 2022-12-05 17:43:17 | c2dc525f-9f21-4b98-87e8-8ded5f0bdd37 | 30-34 | 19.96 | 3.0 | 31.283333 | 26.294727 | -0.329317 | 0.608804 | NaN | 553.113611 |
| 7 | 2022-10-03 20:03:17 | 20941a03-d666-4718-851c-5016640f2c87 | 50-54 | 1.00 | 1.0 | 1.000000 | 0.000000 | -1.000000 | 0.495303 | NaN | NaN |
| 8 | 2023-02-14 11:48:38 | 889a2767-dbee-4ac0-a030-f2b921f0867c | 75-79 | 4.97 | 1.0 | 4.970000 | 0.000000 | 0.287788 | 0.355177 | NaN | 498.531111 |
| 9 | 2022-09-11 11:55:15 | 0a9b41ff-baec-4e30-b4da-b7ade2a14176 | 50-54 | 48.84 | 9.0 | 24.005556 | 16.348748 | 1.311959 | 0.823893 | 2.69 | 97.736667 |
Save feature list¶
In [8]:
Copied!
# Save feature list
simple_feature_list.save()
# Add description
simple_feature_list.update_description("Simple feature list for the customer x productgroup engagement")
# Save feature list
simple_feature_list.save()
# Add description
simple_feature_list.update_description("Simple feature list for the customer x productgroup engagement")
Done! |████████████████████████████████████████| 100% in 3.1s (0.32%/s) Done! |████████████████████████████████████████| 100% in 6.2s (0.16%/s) Loading Feature(s) |████████████████████████████████████████| 9/9 [100%] in 0.3s Done! |████████████████████████████████████████| 100% in 6.1s (0.17%/s) Done! |████████████████████████████████████████| 100% in 6.1s (0.17%/s) Loading Feature(s) |████████████████████████████████████████| 9/9 [100%] in 0.4s