原文链接:http://tecdat.cn/?p=5521
Data background
A telephone company is interested in determining which customer characteristics are useful for predicting churn, customers who will leave their service.
The data set is Churn . The fields are as follows:
State |
discrete. |
account length |
continuous. |
area code |
continuous. |
phone number |
discrete. |
international plan |
discrete. |
voice mail plan |
discrete. |
number vmail messages |
continuous. |
total day minutes |
continuous. |
total day calls |
continuous. |
total day charge |
continuous. |
total eve minutes |
continuous. |
total eve calls |
continuous. |
total eve charge |
continuous. |
total night minutes |
continuous. |
total night calls |
continuous. |
total night charge |
continuous. |
total intl minutes |
continuous. |
total intl calls |
continuous. |
total intl charge |
continuous. |
number customer service calls |
continuous. |
churn |
Discrete |
Data Preparation and Exploration
从数据概览中我们可以发现没有缺失数据,同时可以发现电话号 地区代码是没有价值的变量,可以删去
Examine the variables graphically
从上面的结果中,我们可以看到churn为no的样本数目要远远大于churn为yes的样本,因此所有样本中churn占多数。
从上面的结果中,我们可以看到除了emailcode和areacode之外,其他数值变量近似符合正态分布。
Relationships between variables
从结果中我们可以看到两者之间存在显著的正相关线性关系。
Using the statistics node, report
如果把高相关性的变量保存下来,可能会造成多重共线性问题,因此需要把高相关关系的变量删去。
Data Manipulation
从结果中可以看到,total.day.calls和total.day.charge之间存在一定的相关关系。
特别是voicemial为no的变量之间存在负相关关系。
Discretize (make categorical) a relevant numeric variable
对变量进行离散化
construct a distribution of the variable with a churn overlay
construct a histogram of the variable with a churn overlay
Find a pair of numeric variables which are interesting with respect to churn.
从结果中可以看到,total.day.calls和total.day.charge之间存在一定的相关关系。
Model Building
特别是churn为no的变量之间存在相关关系。
从结果中看,我们可以发现 state total.intl.calls 、number.customer.service.calls 、 total.day.minutes1medium 、 total.day.minutes1short 的变量有重要的影响。
Use K-Nearest-Neighbors (K-NN) algorithm to develop a model for predicting Churn
混淆矩阵(英语:confusion matrix)是可视化工具,特别用于监督学习,在无监督学习一般叫做匹配矩阵。 矩阵的每一列代表一个类的实例预测,而每一行表示一个实际的类的实例。
从测试集的结果,我们可以看到准确度达到86%。
Findings
我们可以发现 ,total.day.calls和total.day.charge之间存在一定的相关关系。特别是churn为no的变量之间存在相关关系。同时我们可以发现 state total.intl.calls 、number.customer.service.calls 、 total.day.minutes1medium、 total.day.minutes1short 的变量有重要的影响。同时我们可以发现,total.day.calls和total.day.charge之间存在一定的相关关系。最后从knn模型结果中,我们可以发现从训练集的结果中,我们可以看到准确度有80%,从测试集的结果,我们可以看到准确度达到86%。说明模型有很好的预测效果。