6. Formulate Use Case
Why Create a Use Case?¶
Creating a Use Case in FeatureByte, while optional, offers significant benefits. It not only defines the goal and application of your prediction model but also helps organize your training data and improve post-deployment feature monitoring.
Plus, for FeatureByte Enterprise users, it's used by FeatureByte's Feature Ideation engine to suggest features tailored to your use cases.
We'll create one Use Case for our Loan Applications Dataset:
Loan Default by client: Predict clients' payment difficulties the next 6 months for new loan based on its early stage application data and prior credit history.
We will define a Context, establish a Target and then link the Use Case with the Context and Target.
import featurebyte as fb
# 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:12 | INFO | SDK version: 3.0.1.dev45 INFO :featurebyte:SDK version: 3.0.1.dev45 14:08:12 | INFO | No catalog activated. INFO :featurebyte:No catalog activated. 14:08:12 | INFO | Using profile: tutorial INFO :featurebyte:Using profile: tutorial 14:08:12 | INFO | Using configuration file at: /Users/gxav/.featurebyte/config.yaml INFO :featurebyte:Using configuration file at: /Users/gxav/.featurebyte/config.yaml 14:08:12 | INFO | Active profile: tutorial (https://tutorials.featurebyte.com/api/v1) INFO :featurebyte:Active profile: tutorial (https://tutorials.featurebyte.com/api/v1) 14:08:13 | INFO | SDK version: 3.0.1.dev45 INFO :featurebyte:SDK version: 3.0.1.dev45 14:08:13 | INFO | No catalog activated. INFO :featurebyte:No catalog activated. 14:08:13 | INFO | Catalog activated: Loan Applications Dataset SDK Tutorial INFO :featurebyte.api.catalog:Catalog activated: Loan Applications Dataset SDK Tutorial 16:06:14 | INFO | No catalog activated. 16:06:14 | INFO | Catalog activated: Grocery Dataset Tutorial
Create a Context¶
A Context defines the scope and circumstances in which features are expected to be served.
Let's describe the Context for our use case:
- Context Name: New Loan Application
- Description: Loan application under review.
- Primary Entity: New Application
context_name = "New Loan Application"
fb.Context.create(
context_name,
primary_entity=["New Application"],
description="Loan application under review.",
)
name | New Loan Application | ||||||||
created_at | 2025-06-02 05:50:13 | ||||||||
updated_at | None | ||||||||
description | Loan application under review. | ||||||||
author | None | ||||||||
primary_entities |
|
||||||||
default_eda_table | None | ||||||||
default_preview_table | None | ||||||||
associated_use_cases | [] |
Creating a Target¶
For this use case, we'll use the descriptive approach, as the target cannot be derived directly from the data and must be provided alongside the observation tables.
For an example of a target computed by the SDK, check out the Grocery SDK Tutorial.
target_name = "Loan_Default"
target = fb.TargetNamespace.create(
name=target_name,
window="182d",
dtype="INT",
primary_entity=["New Application"],
target_type=fb.TargetType.CLASSIFICATION,
)
Create a Use Case¶
Let's link our Use Case with the Context and Target.
use_case_name = "Loan Default by client"
use_case_description = (
"Predict clients' payment difficulties the next 6 months for new loan based on its "
"application data and prior credit history."
)
fb.UseCase.create(
name=use_case_name,
target_name=target_name,
context_name=context_name,
description=use_case_description,
)
name | Loan Default by client | ||||||||
created_at | 2025-06-02 05:50:15 | ||||||||
updated_at | None | ||||||||
description | Predict clients' payment difficulties the next 6 months for new loan based on its application data and prior credit history. | ||||||||
author | None | ||||||||
primary_entities |
|
||||||||
context_name | New Loan Application | ||||||||
target_name | Loan_Default | ||||||||
default_eda_table | None | ||||||||
default_preview_table | None |
List targets, contexts and use cases in the catalog¶
catalog.list_targets()
id | name | dtype | entities | created_at | |
---|---|---|---|---|---|
0 | None | Loan_Default | INT | [New Application] | 2025-06-02T05:50:14.874000 |
catalog.list_contexts()
id | name | primary_entity_ids | description | |
---|---|---|---|---|
0 | 683d3b95e1689f620853fa3d | New Loan Application | [683d3ad661061d4da44450d0] | Loan application under review. |
catalog.list_use_cases()
id | name | default_preview_table_name | default_eda_table_name | description | |
---|---|---|---|---|---|
0 | 683d3b97e1689f620853fa40 | Loan Default by client | None | None | Predict clients' payment difficulties the next... |