HomeGuidesRecipesChangelog
Guides

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.)

  1. Inputs
    You receive events split into history and future, along with entity attributes and context.

  2. Define time windows & intervals
    Establish precise intervals to consider in both history and future datasets.

  3. Transformations
    Within these intervals, you perform necessary operationsβ€”such as aggregations (e.g., sum, count, mean), filtering or grouping events.

  4. Output
    Return outputs aligned with the chosen task’s format:

    • For classification or regression tasks, return a np.ndarray with dtype=np.float32
    • For recommendation tasks, return a sketch

The image below summarizes the entire concept of target function.



To further your understanding, we have broken down the learning into several detailed subpages:



You’re also welcome to explore our Recipes β€” a collection of in-depth examples and guides covering target function creation by use case.