- Source page: Analytics Reporter Agent Personality - Concepts: RFM-Analysis, Marketing-Attribution - Updated: index.md (entry fix), overview.md (Support dept), log.md
80 lines
3.2 KiB
Markdown
80 lines
3.2 KiB
Markdown
---
|
||
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 领域的客户分析子方向
|