business analytics
slug: step-classifyAssigns categorical labels to dataset rows based on user-defined conditional rules. Useful for segmenting customers, scoring leads, or creating flags based on business logic.
data) and applies a series of conditional rules to each row.Each rule contains a when condition and a then value:
true is applied.else clause is defined, that value is used.else, the output value is set to null.outputColumn).Important: Conditions are evaluated sequentially, and the first match wins.
outputColumn (string) – Name of the column to store the classification result.rules (array) – Ordered list of rules with the following structure:
- when: "condition_expression"
then: "label_value"
- else: "default_label"
when expressions are evaluated per row.else is optional and provides a default classification.when conditionsAND, OR, ==, >=, etc.)data: Original dataset with an additional column (outputColumn) containing the classificationpdv: Updated PDV metadata (adds outputColumn if new)extras: Passed through unchangedoutputType: 'work'steps:
- classify:
source: rfm_scores
outputColumn: segment
rules:
- when: "rScore == 5 AND fScore == 5 AND mScore == 5"
then: "Champions"
- when: "rScore >= 4 AND fScore >= 4 AND mScore >= 4"
then: "Loyal Customers"
- when: "rScore <= 2 AND fScore <= 2"
then: "At Risk"
- else: "Other"
Explanation:
when conditions exist in the dataset.else clause to avoid null classifications.