Sub topic 4
Segmenting customers so thresholds make sense
This chapter assumes you know what a scenario and a threshold are, and that you can read basic Python. It covers how customer segmentation changes the parameters a rule uses.
Why one threshold does not fit everyone
A cash deposit of 9,500 means different things for different customers. A small retail customer who earns a modest salary rarely deposits that much cash. A restaurant owner may do it every day. If both customers face the same rule, one of two things happens. The retail customer is missed, or the restaurant floods the analysts with alerts.
Segmentation is the practice of dividing customers into groups whose expected behavior is similar. Each group is a segment, and the members of a segment are peers. The monitoring system then applies a separate set of parameters to each segment.
How segments are built
Segments usually come from data the system already holds, as described in the data inputs chapter. Common attributes are:
- Customer type, such as individual, small business or corporate.
- Industry or occupation, such as restaurant, law firm or student.
- Product holdings and account type.
- Expected activity declared at onboarding, such as monthly cash volume.
- Country of residence or operation.
Some institutions assign segments by fixed rules on these attributes. Others use clustering on historical activity. Either way, each customer should land in exactly one segment for a given scenario, so the system knows which parameter set to load.
Segment-specific parameters
The structuring rule from the previous chapter takes its limits from a params dictionary. Segmentation means keeping one dictionary per segment and choosing the right one for each customer.
PARAMS = {
"retail": {"lookback_days": 7, "min_count": 3, "floor": 8000, "ceiling": 10000},
"cash_business": {"lookback_days": 7, "min_count": 6, "floor": 8000, "ceiling": 10000},
}
customer_segment = {
"C1": "retail",
"C2": "cash_business",
}
def params_for(customer_id, default_segment="retail"):
"""Return the parameter set for a customer's segment."""
segment = customer_segment.get(customer_id, default_segment)
return PARAMS[segment]
print(params_for("C1")["min_count"]) # 3
print(params_for("C2")["min_count"]) # 6Here the cash business needs six qualifying deposits in a week before an alert fires, while a retail customer needs only three. The rule logic stays the same. Only the parameters change.
Where segmentation fits in the flow
Because the segment is looked up before evaluation, the rule code does not need to know why a threshold differs. This keeps the scenario simple and puts the business judgment in configuration.
Common errors
- Segments that are too broad. Mixing a corner shop and a casino cash desk in one segment forces a threshold that fits neither.
- Segments that are too narrow. A segment with only a handful of customers gives too little history to justify its thresholds.
- Stale assignments. A customer who changes business keeps the old segment and its old thresholds until the data is refreshed.
- No default. A customer with missing attributes may be skipped by the rule. Define a fallback segment, and consider using the stricter one.
- Loose thresholds hiding risk. Raising a segment's threshold reduces alerts but also reduces coverage. Record why each difference exists so it can be reviewed and validated later.
Exercise
A new restaurant customer has no industry recorded, so the system cannot assign a segment. Give one risk of skipping the structuring rule for this customer and one safer way to handle the missing data.
Show answer
Skipping the rule means the customer's structuring activity is never monitored, which creates a coverage gap. A safer approach is to assign a default segment, preferably one with stricter thresholds, and flag the record for data correction so the customer can be moved to the right segment.