4.14- -| 回首页 | 2005年索引 | - -test

数据挖掘实例

                                      

德国贷款公司

 

 

目的:

 

给定某些属性,判断某贷款顾客的可信性(即"good/bad"状况)。

 

 

简单思路:

      

       该数据包含了666条贷款顾客的历史数据和21个属性。但是我们认为,这21个属性不都能够有效地帮助我们判断顾客的可行性,所以我们首先把一些比较不相关的属性去掉。接下来,我们再用聚类方法帮助我们把带有连续变量的属性离散化。做完预处理后我们再从中找出对有参考价值的关联规则。

 

 

基本步骤:

 

      

1.去掉多余属性

 

关联规则的随机性

该数据里有一布尔属性foreign workers,取值为yesno。我们发现,其中取值为yes的元组占了所有元组的96%。置信度其实代表了一种条件概率,它无法判断两个属性之间是否带有随机性。因此,带有foreign workers的关联规则无法提供我们更多可以参考的信息。

 

χ2依赖性检验

首先,我们利用χ2-检验试探各属性("Duration in months", "Credit Amount" "Age in years" 除外)"good/bad"属性之间是否存有依赖性。

 

以下以 "Credit History" 为例描述算法:

Credit History

All Paid Duly

Bank Paid Duly

Critical

Delay

Duly Till Now

Total

Good/Bad

Bad

17

18

38

17

119

209

Good

10

17

157

40

233

457

Total

27

35

195

57

352

666


Degrees of freedom: 4

Chi-square value = 32.8752245686945

p-value is less than or equal to 0.001.

The distribution is significant.

χ2-检验显示属性 "Credit History" 与属性 "Good/Bad" 之间存有依赖性。

 


 

经多番检验,只有"Status of Checking Account", "Credit History", "Purpose", "Savings Account / Bonds", "Present Employment Since", "Property", "Housing" 以及 "Foreign Worker" 属性与"good/bad"属性之间有显著性(α0.05)的依赖性。因此,我们将重点放在这9个属性上,再可能的情况下对这几个属性的取值类进行加以分类或归类,希望最终能够从中得到这些属性与"good/bad"属性之间更好的关联规则。

 

 

 

 

 

2.把连续变量离散化(离散化/分类/归类)

 

χ2检验后,我们利用 Clustering Classification 以及 Equal-width 方法针对属性"Duration in months" "Credit Amount" "Age in years"进行离散化以及对以上有显著依赖性的属性取值进行加以分类或归类。

 

Equal-width

 

我们利用weka里的Discretize功能将连续变量离散化。以下以"Duration in months"属性为例:

 

我们用weka.filters.unsupervised.attribute.Discretized功能将"Duration in months"属性的取值分为3大类: "Short-term", "Mid-term" 以及 "Long-term" 。分类后各类的数据数量为:"Short-term"0-12个月)245条数据, "Mid-term"13个月-24个月)270条数据以及 "Long-term"25个月以上)151条数据。



Simple K-Means Clustering

 

K-Means算法是将数据分入预先设定的聚类数。首先,它随机性地将几个数据点设定为质心(cluster centroid)。接着,它再计算出各聚类的边界及新的质心位置。反复运行以上步骤就会得到预先想得到的几个聚类,从而把连续变量值离散化,或进一步聚类某些属性的取值分类。

 

"Credit Amount" 属性为例描述Simple K-Means Clustering 离散化方法:

我们利用weka里的Cluster功能SimpleKMeans算法将"Credit Amount"属性中的取值离散化,分为4类:"low"0-2500),"mid"2501-4400),"high"4401-8500) 及"veryhigh"8500以上)。请看下图。




Classification

 

我们也把property属性重新离散化,把各个取值再加以分类,希望能够从中得到更有参考价值的关联规则。



属性与其取值聚类

 

属性

取值聚类

属性

取值聚类

Status of Existing Checking Account

  • 0DM
  • <200DM
  • >200DM
  • no checking account

Personal Status and Sex

  • single male
  • married male
  • divorced male
  • divorced female

Duration in month

  • <13 (short-term)
  • 13-24 (mid-term)
  • >24 (long-term)

Other Debtors / Guarantors

  • none
  • co-applicant
  • guarantor

Credit History

  • all paid duly
  • bank paid duly
  • critical
  • duly till now
  • delay

Property

  • real estate
  • building society
  • car
  • unknown

Purpose

  • tangible
    • car
      • used
      • new
    • household
      • furniture
      • radio-tv
  • intangible
    • business
    • repair
    • education
    • retraining

Age in years

  • <22 (young)
  • 23-35 (mid)
  • 36-51 (old)
  • >51 (retired)

Credit Amount

  • 0-2500 (low)
  • 2501-4400 (mid)
  • 4401-8500 (high)
  • >8500 (veryhigh)

Other Installment Plans

  • banks
  • stores
  • none

Savings Account / Bonds

  • <100DM
  • 100-500DM
  • 500-1000DM
  • >1000DM
  • unknown / no savings account

Housing

  • rent
  • own
  • for free

 

Present Employment Since

  • unemployed
  • 1-4
  • above 4

Number of Existing Credits at This Bank

  • one
  • two

Number of People being Liable to Provide Maintenance for

  • one
  • two

Status

  • good
  • bad

 

 

3.关联规则

 

利用wekaassociation功能,我们得到许多的关联规则。在众多关联规则中,以下15条规则属于较有参考价值:

 

1.      Statusofexistingcheckingaccount=noaccount Purpose-3=Tangible Personalstatusandsex=single-male Other-debtors/guarantors=none Otherinstallmentplans=none Housing=own ==> Status=good.     conf:(0.95)

 

2.      Statusofexistingcheckingaccount=noaccount Credithistory=dulytillnow Housing=own Numberofexistingcreditsatthisbank=one Liabletoprovidemaintenancefor=one ==> status=good. conf:(0.92)

 

3.      Statusofexistingcheckingaccount=noaccount Presentemploymentsince=over-seven ==> status=good.    conf:(0.91)

 

4.      Statusofexistingcheckingaccount=noaccount Credithistory=dulytillnow Numberofexistingcreditsatthisbank=one Liabletoprovidemaintenancefor=one ==> status=good.    conf:(0.90)

 

5.      Purpose=radio-tv Housing=own Job=skilled ==> status=good.                                  conf:(0.89)

 

6.      Presentemploymentsince=>4-years Ageinyears=middleage Job=skilled ==> status=good.   conf:(0.88)

 

7.      Statusofexistingcheckingaccount=noaccount Durationinmonth=mid-term Housing=own ==> status=good.                                                                                                     conf:(0.88)

 

8.      Statusofexistingcheckingaccount=noaccount Credithistory=dulytillnow Housing=own ==> status=good.                                                                                                              conf:(0.87)

 

9.      Purpose-3=Tangible Personalstatusandsex=single-male Other-debtors/guarantors=none Otherinstallmentplans=none Housing=own Job=skilled ==> Status=good.                    conf:(0.86)

 

10.  Statusofexistingcheckingaccount=noaccount Property=car Housing=own ==> Status=good.    conf:(0.86)

 

11.  Purpose-2=Household Presentemploymentsince=>4-years ==> Status=good.                 conf:(0.85)

 

12.  Credit-amount-simplekmeans=low Property=real-estate ==> Status=good.                       conf:(0.77)

 

13.  Purpose-2=Household Credit-amount-simplekmeans=low ==> Status=good.              conf:(0.76)

 

14.  Purpose-2=Household Job=skilled ==> Status=good.                                                 conf:(0.73)

 

15.  Presentemploymentsince=>4-years Job=skilled ==> Status=good.                            conf:(0.72)

 

 

4Weightage:

 

根据所得关联规则,我们发现以下13属性的某些取值类倾向属性 "Status"=good.:

 

根据历史数据,若某顾客拥有以上13个属性值的任意7个,我们可以认为该顾客的Statusgood

 

 

 

5.预测:

 

我们可用以上weightage方法来预测Germantest数据库中顾客的"Status"。我们从Germantest数据库中取出一名顾客的资料来预测他的"Status"

 

no-account,24, duly-till-now, new-car,1393, less100DM, four-years,2, single-male, guarantor,2, real-estate,31, none, own,1, skilled,1, no, yes

 

该顾客的得分为10分,因此该名顾客的预测Statusgood.

 

 

 

结论:

 

       经过大量的预处理,包括假设检验、分类、聚类和离散化等方法,我们客观地把一些属性去掉,也将连续属性离散化。最终我们也从"海量"关联规则中筛选出一些较有参考价值的规则,来帮助我们判断某顾客的可信性。




【作者: carouter】【访问统计:】【2005年04月18日 星期一 12:00】【 加入博采】【打印

Trackback

你可以使用这个链接引用该篇文章 http://publishblog.blogchina.com/blog/tb.b?diaryID=1231616

回复

- 评论人:老员工   2006-04-06 11:25:59   

呵呵,重新排一下版吧,看着太费劲了。

验证码:   
评论内容: