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 Ideation engine to suggest features tailored to your use cases.
We'll create one Use Case for our Credit Default 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 = "Credit Default Dataset SDK Tutorial"
catalog = fb.Catalog.activate(catalog_name)
16:59:23 | INFO | SDK version: 3.2.0.dev66 INFO :featurebyte:SDK version: 3.2.0.dev66 16:59:23 | INFO | No catalog activated. INFO :featurebyte:No catalog activated. 16:59:23 | INFO | Using profile: staging INFO :featurebyte:Using profile: staging 16:59:23 | INFO | Using configuration file at: /Users/gxav/.featurebyte/config.yaml INFO :featurebyte:Using configuration file at: /Users/gxav/.featurebyte/config.yaml 16:59:23 | INFO | Active profile: staging (https://staging.featurebyte.com/api/v1) INFO :featurebyte:Active profile: staging (https://staging.featurebyte.com/api/v1) 16:59:23 | INFO | SDK version: 3.2.0.dev66 INFO :featurebyte:SDK version: 3.2.0.dev66 16:59:23 | INFO | No catalog activated. INFO :featurebyte:No catalog activated. 16:59:23 | INFO | Catalog activated: Credit Default Dataset SDK Tutorial INFO :featurebyte.api.catalog:Catalog activated: Credit Default 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-10-15 08:59:24 | ||||||||
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-10-15 08:59:24 | ||||||||
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-10-15T08:59:24.338000 |
catalog.list_contexts()
id | name | primary_entity_ids | description | |
---|---|---|---|---|
0 | 68ef626b11c7e23eceb087f0 | New Loan Application | [68ef62316bb594c3d5cc80b4] | Loan application under review. |
catalog.list_use_cases()
id | name | default_preview_table_name | default_eda_table_name | description | |
---|---|---|---|---|---|
0 | 68ef626c11c7e23eceb087f3 | Loan Default by client | None | None | Predict clients' payment difficulties the next... |