7. Create Observation Tables
Create Observation Table¶
An Observation Set is a collection that combines specific moments in history (timestamps) with related entity key values, used to determine feature values for those moments. Think of it as the backbone of a training dataset.
An Observation Table is its representation in the feature store.
You can either:
- upload an Observation Table from a parquet or csv file
- create it from a View,
- or create it from a Source Table.
This guide explains how to configure Observation Tables from a Source Table and link them to our Credit Default context and use case.
We will create Applications up to Sept 2024 with Loan Defaults: Credit Default Observations for TRAINING up to Sept 2024.
For an example how to upload an Observation Table or create it from a view, check out the Grocery SDK Tutorial. The tutorial also covers how to add Target values when your target has been registered with a logical approach.
import featurebyte as fb
import pandas as pd
# Set your profile to the tutorial environment
fb.use_profile("tutorial")
catalog_name = "Loan Applications Dataset SDK Tutorial"
catalog = fb.Catalog.activate(catalog_name)
14:08:31 | INFO | SDK version: 3.0.1.dev45 INFO :featurebyte:SDK version: 3.0.1.dev45 14:08:31 | INFO | No catalog activated. INFO :featurebyte:No catalog activated. 14:08:31 | INFO | Using profile: tutorial INFO :featurebyte:Using profile: tutorial 14:08:31 | INFO | Using configuration file at: /Users/gxav/.featurebyte/config.yaml INFO :featurebyte:Using configuration file at: /Users/gxav/.featurebyte/config.yaml 14:08:31 | INFO | Active profile: tutorial (https://tutorials.featurebyte.com/api/v1) INFO :featurebyte:Active profile: tutorial (https://tutorials.featurebyte.com/api/v1) 14:08:31 | INFO | SDK version: 3.0.1.dev45 INFO :featurebyte:SDK version: 3.0.1.dev45 14:08:31 | INFO | No catalog activated. INFO :featurebyte:No catalog activated. 14:08:32 | INFO | Catalog activated: Loan Applications Dataset SDK Tutorial INFO :featurebyte.api.catalog:Catalog activated: Loan Applications Dataset SDK Tutorial 16:06:21 | WARNING | Remote SDK version (1.1.0.dev7) is different from local (1.1.0.dev1). Update local SDK to avoid unexpected behavior. 16:06:21 | INFO | No catalog activated. 16:06:21 | INFO | Catalog activated: Grocery Dataset Tutorial
Locate Source Table¶
ds = catalog.get_data_source()
DATABASE_NAME = "DEMO_DATASETS"
SCHEMA_NAME = "LOAN_APPLICATIONS"
training_observations = ds.get_source_table(
database_name=DATABASE_NAME,
schema_name=SCHEMA_NAME,
table_name="OBSERVATIONS_WITH_TARGET",
)
Locate the Target, Context and Use Case, the observation tables will be linked to¶
context_name = "New Loan Application"
target_name = "Loan_Default"
use_case_name = "Loan Default by client"
usecase = catalog.get_use_case(use_case_name)
Create Applications up to Sept 2024 with Loan Defaults table¶
observation_train_table_name = "Applications up to Sept 2024 with Loan Defaults"
observation_train_table = training_observations.create_observation_table(
name=observation_train_table_name,
sample_rows=None,
sample_from_timestamp="2018-01-01",
sample_to_timestamp="2024-10-01",
context_name=context_name,
primary_entities=["New Application"],
target_column=target_name,
)
observation_train_table.update_purpose(fb.Purpose.TRAINING)
# link it to the use case
usecase.add_observation_table(observation_train_table_name)
Done! |████████████████████████████████████████| 100% in 15.2s (0.07%/s) Done! |████████████████████████████████████████| 100% in 15.2s (0.07%/s)
List observation tables in catalog¶
catalog.list_observation_tables()
id | name | type | shape | feature_store_name | created_at | |
---|---|---|---|---|---|---|
0 | 683d3bde07274be4537267b1 | Applications up to Sept 2024 with Loan Defaults | source_table | [303270, 3] | playground | 2025-06-02T05:51:37.364000 |