industries

Pyvorin for Customer Segmentation

RFM analysis, cohort building, and clustering.

Published May 30, 2026

RFM Analysis

Recency, Frequency, Monetary value segmentation compiled for batch scoring.

def rfm_score(customer, thresholds):
    r = bin_value(customer.recency, thresholds['recency'])
    f = bin_value(customer.frequency, thresholds['frequency'])
    m = bin_value(customer.monetary, thresholds['monetary'])
    return r * 100 + f * 10 + m

Cohort Building

Group customers by acquisition month and track retention curves.

Clustering

K-means and hierarchical clustering for behavioural segments.