客户与产品细分基础

Python 营销中的机器学习

Karolis Urbonas

Head of Analytics & Science, Amazon

数据格式

# Customer by product/service matrix
wholesale.head()

批发表头

Python 营销中的机器学习

无监督学习模型

  • 层次聚类
  • K-means
  • 非负矩阵分解(NMF)
  • 双聚类
  • 高斯混合模型(GMM)
  • 还有更多
Python 营销中的机器学习

无监督学习模型

  • 层次聚类
  • K-means
  • 非负矩阵分解(NMF)
  • 双聚类
  • 高斯混合模型(GMM)
  • 还有更多
Python 营销中的机器学习

无监督学习步骤

  1. 初始化 模型
  2. 拟合 模型
  3. 分配 簇标签
  4. 探索 结果
Python 营销中的机器学习

探索变量

wholesale.agg(['mean','std']).round(0)
        Fresh    Milk  Grocery  Frozen  Detergents_Paper  Delicassen
mean  12000.0  5796.0   7951.0  3072.0            2881.0      1525.0
std   12647.0  7380.0   9503.0  4855.0            4768.0      2820.0
# Get the statistics
averages = wholesale.mean()
st_dev = wholesale.std()
x_names = wholesale.columns
x_ix = np.arange(wholesale.shape[1])

# Plot the data import matplotlib.pyplot as plt plt.bar(x_ix-0.2, averages, color='grey', label='Average', width=0.4) plt.bar(x_ix+0.2, st_dev, color='orange', label='Standard Deviation', width=0.4) plt.xticks(x_ix, x_names, rotation=90) plt.legend() plt.show()
Python 营销中的机器学习

均值与标准差的条形图

条形图

Python 营销中的机器学习

用成对图可视化分布

import seaborn as sns
sns.pairplot(wholesale, diag_kind='kde')
plt.show()
Python 营销中的机器学习

成对图回顾

成对图(原始)

Python 营销中的机器学习

¡Vamos a practicar!

Python 营销中的机器学习

Preparing Video For Download...