Skip to content

UseCase

A UseCase object formulates the modelling problem by associating a context with a target. UseCase objects facilitate the organization of your observation tables, feature tables and deployments. UseCase objects also play a crucial role in Ideation, enabling it to provide tailored feature suggestions.

Creating a UseCase

To construct a new Use Case, the following information is required:

  1. Select a Context: Choose a registered Context that defines the environment of your UseCase.

  2. Define a Target: Specify a registered Target that represents the goal of your UseCase.

Note

The context and target must correspond to the same entities.

Use the create() class method to add the UseCase to the active catalog:

use_case = fb.UseCase.create(
    name="Credit Card Fraud Detection",
    target_name="Is Fraudulent Transaction",
    context_name="New Transaction",
)

For a comprehensive use case setup, include a detailed description:

use_case.update_description(
    "This use case aims to detect at an early stage credit card fraudulent transactions (any time within 30 minutes after the transaction has been processed). The detection only focuses on purchase transactions."
)

Note

You can also use the description parameter in the create() class method.

Providing a detailed description of the use case, context, and target ensures better documentation and enhances the effectiveness of the Ideation in suggesting relevant features and assessing their relevance.

Creating a Use Case for Causal Modeling

When the Context is associated with a Treatment, the Use Case enables causal inference and uplift modeling. This allows you to measure the conditional average treatment effect (CATE) and understand how treatments impact different segments of your population.

# Create a use case with a context that has a treatment
use_case = fb.UseCase.create(
    name="Churn Campaign Revenue Impact",
    target_name="Revenue_next_30d",
    context_name="Active Customers in Churn Campaign",
    description="Measure the causal impact of the churn campaign on customer revenue"
)

For causal modeling use cases, you should specify the prediction_higher_is_better parameter using the update_prediction_higher_is_better() method. This parameter determines how the model will be evaluated and how uplift will be calculated:

  • True: Higher target values are better (e.g., revenue, engagement, purchases). The model maximizes positive treatment effects.
  • False: Lower target values are better (e.g., churn rate, cost, defect rate). The model maximizes negative treatment effects.
# For revenue maximization (higher is better)
use_case.update_prediction_higher_is_better(True)

# For cost or churn minimization (lower is better)
use_case.update_prediction_higher_is_better(False)

This setting ensures that: - Model evaluation metrics correctly interpret treatment effects - Feature importance reflects contributions to the desired outcome direction - Deployment recommendations optimize for the correct objective

Current Support

At this stage, FeatureByte supports causal modeling for randomized binary treatments only. Support for multi-arm and continuous treatments, as well as observational studies, will be added in future releases.

Creating a Use Case for Forecast Modeling

When the Context includes a ForecastPointSchema, the Use Case is automatically typed as a FORECAST use case. This enables time series forecasting where predictions are made for specific future dates.

In a forecast use case, observation tables must include both POINT_IN_TIME (when the prediction is made) and FORECAST_POINT (the future date being predicted for).

# Create a use case with a forecast context
use_case = fb.UseCase.create(
    name="Daily Store Sales Forecast",
    target_name="Sales_next_day",
    context_name="Daily Sales Forecast",
    description="Predict daily sales for each store at various forecast horizons"
)

Features derived from the forecast point (such as forecast month, day of week, or forecast horizon) are automatically available through the context's get_forecast_point_feature() method.

Association with Observation Table

Once the Use Case is defined, you can link an observation table to the UseCase using the add_observation_table() method.

use_case = catalog.get_use_case("Credit Card Fraud Detection")
use_case.add_observation_table(<observation_table_name>)

Note

Observation tables are automatically linked to a Use Case when they are derived from

  • an observation table that is linked to the use case's context
  • a target that is linked to the use case

You can also define an observation table to be used as the default preview / eda table for the UseCase using the update_default_eda_table() and update_default_preview_table() methods.

use_case.update_default_eda_table(<observation_table_name>)
use_case.update_default_preview_table(<observation_table_name>)

Finally, you can list observation tables associated with the UseCase using the list_observation_tables() method.

use_case.list_observation_tables()

Association with Deployment

Deployments associated with a use case can be listed easily using the list_deployments() method.

use_case.list_deployments()

Note

A deployment is associated with a use case when the use case is specified during the related feature list deployment.

Association with Feature Table

Feature tables associated with a use case can be listed easily using the list_feature_tables() method.

use_case.list_feature_tables()

Note

Feature tables are automatically associated with use cases via the observation tables they originate from.

See Also

  • Context: Define the circumstances where features are served
  • Target: Define prediction outcomes for machine learning models
  • Treatment: Define causal treatment variables for uplift modeling
  • Observation Table: Tables containing observation data for feature serving
  • Feature List: Collections of features for model training and deployment