Defining the Task and Target of the Model
How to set the objective for your model?
Check This First!This article refers to BaseModel accessed via Docker container. Please refer to Snowflake Native App section if you are using BaseModel as SF GUI application.
To fine-tune the foundation model for your specific business scenario, you need to:
- Select the machine learning problem that best fits your business scenario and produces actionable outputsβfor example, a single probability value indicating customer churn, or an array of scores indicating a user's likelihood to choose various brands.
- Define the target function that the model will aim to approximate. This function transforms the predicted events into the desired output (e.g., binary labels, continuous values, or sketches representing entity recommendations).
Specifying these two components correctly is essential for training a downstream model that effectively addresses your business goals.
Select the machine learning problem
Below are typical business use cases translated into ML problems supported by BaseModel Class Tasks, each with clarified Output formats:
Binary Classification
Use Cases
- Predict propensity to churn for retention campaigns
- Estimate no-show likelihood at clinics
- Forecast user interest to prompt subscription
- Detect fraudulent transactions
BaseModel Class Task
BinaryClassificationTask
Output
A np.array
with a single float32 value (0 or 1)
Multi-class Classification
Use Cases
- Predict a customer's favorite brand for targeting
- Recommend a subscription plan
- Determine likely vehicle trim level for relevant offers
BaseModel Class Task
MulticlassClassificationTask
Output
A np.array
of float32 valuesβone per class, summing to 1
Multi-label Classification
Use Cases
- Predict multiple products a customer may buy for personalization
- Recommend services for cross-selling
- Suggest game genres a player might enjoy
BaseModel Class Task
MultilabelClassificationTask
Output
A np.array
of float32 values (0 or 1) per class
Regression
Use Cases
- Estimate customer lifetime value (LTV)
- Forecast customer profitability
- Predict telecom data usage volumes
BaseModel Class Task
RegressionTask
Output
A np.array
of float32 continuous value(s)
Recommendation
Use Cases
- Select products for personalized web pages
- Populate a βYour grocery favoritesβ section
- Recommend new games based on user behavior
- Recommend a customerβs favorite brands
- Recommend relevant services for a customerβs needs
BaseModel Class Task
RecommendationTask
β suitable for high-cardinality entity spaces (e.g., large product catalogs, marketplaces, movies)OneHotRecommendationTask
β ideal for low-cardinality cases (e.g., limited SKUs, service catalogs, brand-level recommendations)
Output
A sketchβa specialized, efficient BaseModel representation for entity behavior
Build the Target Function
The target function offers a streamlined view of the modelβs training logic. It maps input data (history and future events, entity attributes, context) to the required problem-specific output (label, value, etc.)
-
Inputs
You receive events split into history and future, along with entity attributes and context. -
Define time windows & intervals
Establish precise intervals to consider in both history and future datasets. -
Transformations
Within these intervals, you perform necessary operationsβsuch as aggregations (e.g., sum, count, mean), filtering or grouping events. -
Output
Return outputs aligned with the chosen taskβs format:- For classification or regression tasks, return a
np.ndarray
withdtype=np.float32
- For recommendation tasks, return a sketch
- For classification or regression tasks, return a
The image below summarizes the entire concept of target function.

To further your understanding, we have broken down the learning into several detailed subpages:
-
Target Function: Inputs
Explore how functions receive inputs like events, main entity attributes, and joined attributes. -
Target Function: Time Window and Operations on Events
Learn how to define time windows, apply transformations and generate the outputs. -
Target Function Examples
Discover use-caseβspecific examples for each task type (e.g. binary classification, recommendation). -
Validating the Target Function
Understand how to validate your target function usingverify_target()
before training the model.
Youβre also welcome to explore our Recipes β a collection of in-depth examples and guides covering target function creation by use case.
Updated 24 days ago