Files
nexus/wiki/concepts/RFM-Analysis.md
weishen 82741b1c69 ingest: support-analytics-reporter.md
- Source page: Analytics Reporter Agent Personality
- Concepts: RFM-Analysis, Marketing-Attribution
- Updated: index.md (entry fix), overview.md (Support dept), log.md
2026-04-25 21:06:28 +08:00

80 lines
3.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "RFM Analysis"
type: concept
tags: []
sources: [support-analytics-reporter]
last_updated: 2026-04-21
---
## Aliases
- RFM Segmentation
- Recency, Frequency, Monetary Analysis
- 客户价值分层分析
## Definition
RFM Analysis 是一种三维客户价值分层方法通过最近购买时间Recency、购买频率Frequency、消费金额Monetary三个维度对客户进行分群从而识别高价值客户、流失风险客户和潜力客户为精准营销和客户运营提供数据支撑。
## Core Metrics
| 维度 | 定义 | 计算方式 |
|------|------|----------|
| Recency | 最近一次购买距今天数 | `当前日期 - 最近购买日期`(越小越好) |
| Frequency | 购买总次数 | `COUNT(order_id)`(越大越好) |
| Monetary | 累计消费金额 | `SUM(revenue)`(越大越好) |
## Scoring Method
每个维度按分位数通常5分位打分
- R_Score最近购买时间越近分数越高1-5分5=最近)
- F_Score购买频率越高分数越高1-5分5=最频繁)
- M_Score消费金额越高分数越高1-5分5=最高金额)
组合 R+F+M 得 RFM Score`555``311`)。
## Customer Segments
| RFM Score | 客户类型 | 策略建议 |
|-----------|---------|---------|
| 555/554/544/545/454/455/445 | Champions冠军客户 | 奖励忠诚度,邀请推荐,升级销售高端产品 |
| 543/444/435/355/354/345/344/335 | Loyal Customers忠诚客户 | 培养关系,推荐新品,忠诚度计划 |
| 553/551/552/541/542/533/532/531/452/451 | Potential Loyalists潜力忠诚者 | 入会欢迎,早期参与,产品教育 |
| 512/511/422/421/412/411/311 | New Customers新客户 | 入职优化,早期参与 |
| 155/154/144/214/215/115/114 | At Risk流失风险客户 | 重新参与活动,特殊优惠,赢回策略 |
| 其他 | Others一般客户 | 常规触达,持续观察 |
## Implementation
```python
import pandas as pd
import numpy as np
def rfm_analysis(df, current_date=None):
"""RFM Analysis implementation"""
if current_date is None:
current_date = df['date'].max()
rfm = df.groupby('customer_id').agg({
'date': lambda x: (current_date - x.max()).days, # Recency
'order_id': 'count', # Frequency
'revenue': 'sum' # Monetary
}).rename(columns={
'date': 'recency',
'order_id': 'frequency',
'revenue': 'monetary'
})
# Create quintile scores (1-5)
rfm['r_score'] = pd.qcut(rfm['recency'], 5, labels=[5,4,3,2,1], duplicates='drop')
rfm['f_score'] = pd.qcut(rfm['frequency'].rank(method='first'), 5, labels=[1,2,3,4,5], duplicates='drop')
rfm['m_score'] = pd.qcut(rfm['monetary'], 5, labels=[1,2,3,4,5], duplicates='drop')
rfm['rfm_score'] = rfm['r_score'].astype(str) + rfm['f_score'].astype(str) + rfm['m_score'].astype(str)
return rfm
```
## Connections
- [[support-analytics-reporter]] — 使用 RFM 进行客户价值分层分析
- [[Customer-Segmentation]] — RFM 是客户细分的核心方法之一
- [[Business-Intelligence]] — 属 BI 领域的客户分析子方向