更多数据挖掘代码:https://github.com/linyiqun/DataMiningAlgorithm
介绍
与GSP一样,PrefixSpan算法也是序列模式分析算法的一种,不过与前者不同的是PrefixSpan算法不产生任何的侯选集,在这点上可以说已经比GSP好很多了。PrefixSpan算法可以挖掘出满足阈值的所有序列模式,可以说是非常经典的算法。序列的格式就是上文中提到过的类似于<a, b, (de)>这种的。
算法原理
PrefixSpan算法的原理是采用后缀序列转前缀序列的方式来构造频繁序列的。举个例子,
比如原始序列如上图所示,4条序列,1个序列中好几个项集,项集内有1个或多个元素,首先找出前缀为a的子序列,此时序列前缀为<a>,后缀就变为了:
<wbr style="font-family:simsun; line-height:21px; background-color:rgb(245,242,239)"><span style="font-family:simsun; line-height:21px; background-color:rgb(245,242,239)"><img src="https://img-blog.csdn.net/20150213090738210?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvQW5kcm9pZGx1c2hhbmdkZXJlbg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" style="border:none; max-width:100%"></span><br></wbr>
"_"下标符代表前缀为a,说明是在项集中间匹配的。这就相当于从后缀序列中提取出1项加入到前缀序列中,变化的规则就是从左往右扫描,找到第1个此元素对应的项,然后做改变。然后根据此规则继续递归直到后续序列不满足最小支持度阈值的情况。所以此算法的难点就转变为了从后缀序列变为前缀序列的过程。在这个过程要分为2种情况,第1种是单个元素项的后缀提前,比如这里的a,对单个项的提前有分为几种情况,比如:
<b a c ad>,就会变为<c ad>,如果a是嵌套在项集中的情况<b c dad r>,就会变为< _d r>,_代表的就是a.如果a在一项的最末尾,此项也会被移除<b c dda r>变为<r>。但是如果是这种情况<_da d d>a包含在下标符中,将会做处理,应该此时的a是在前缀序列所属的项集内的。
还有1个大类的分类就是对于组合项的后缀提取,可以分为2个情况,1个是从_X中寻找,一个从后面找出连续的项集,比如在这里<a>的条件下,找出前缀<(ab)>的后缀序列
第一种在_X中寻找还有没有X=a的情况,因为_已经代表1个a了,还有一个是判断_X != _a的情况,从后面的项集中找到包含有连续的aa的那个项集,然后做变换处理,与单个项集的变换规则一致。
算法的递归顺序
想要实现整个的序列挖掘,算法的递归顺序就显得非常重要了。在探索递归顺序的路上还是犯了一些错误的,刚刚开始的递归顺序是<a>---><a a>----><a a a>,假设<a a a>找不到对应的后缀模式时,然后回溯到<a (aa)>进行递归,后来发现这样会漏掉情况,为什么呢,因为如果 <a a >没法进行到<a a a>,那么就不可能会有前缀<a (aa)>,顶多会判断到<(aa)>,从<a a>处回调的。于是我发现了这个问题,就变为了下面这个样子,经测试是对的。:
加入所有的单个元素的类似为a-f,顺序为
<a>,---><a a>.同时<(aa)>,然后<ab>同时<(ab)>,就是在a添加a-f的元素的时候,检验a所属项集添加a-f元素的情况。这样就不会漏掉情况了,用了2个递归搞定了这个问题。这个算法的整体实现可以对照代码来看会理解很多。最后提醒一点,在每次做出改变之后都会判断一下是否满足最小支持度阈值的。
PrefixSpan实例
这里举1个真实一点的例子,下面是输入的初始序列:
挖掘出的所有的序列模式为,下面是一个表格的形式
在<b>的序列模式中少了1个序列模式。可以与后面程序算法测试的结果做对比。
算法的代码实现
代码实现同样以这个为例子,这样会显得更有说服性。
测试数据:
- bdcbac
- bfcebfg
- ahbfabf
- beced
- abdbcbade
- packageDataMining_PrefixSpan;
- importjava.util.ArrayList;
- /**
- *序列类
- *
- *@authorlyq
- *
- */
- publicclassSequence{
- //序列内的项集
- privateArrayList<ItemSet>itemSetList;
- publicSequence(){
- this.itemSetList=newArrayList<>();
- }
- publicArrayList<ItemSet>getItemSetList(){
- returnitemSetList;
- }
- publicvoidsetItemSetList(ArrayList<ItemSet>itemSetList){
- this.itemSetList=itemSetList;
- }
- /**
- *判断单一项是否包含于此序列
- *
- *@paramc
- *待判断项
- *@return
- */
- publicbooleanstrIsContained(Stringc){
- booleanisContained=false;
- for(ItemSetitemSet:itemSetList){
- isContained=false;
- for(Strings:itemSet.getItems()){
- if(itemSet.getItems().contains("_")){
- continue;
- }
- if(s.equals(c)){
- isContained=true;
- break;
- }
- }
- if(isContained){
- //如果已经检测出包含了,直接挑出循环
- break;
- }
- }
- returnisContained;
- }
- /**
- *判断组合项集是否包含于序列中
- *
- *@paramitemSet
- *组合的项集,元素超过1个
- *@return
- */
- publicbooleancompoentItemIsContain(ItemSetitemSet){
- booleanisContained=false;
- ArrayList<String>tempItems;
- StringlastItem=itemSet.getLastValue();
- for(inti=0;i<this.itemSetList.size();i++){
- tempItems=this.itemSetList.get(i).getItems();
- //分2种情况查找,第一种从_X中找出x等于项集最后的元素,因为_前缀已经为原本的元素
- if(tempItems.size()>1&&tempItems.get(0).equals("_")
- &&tempItems.get(1).equals(lastItem)){
- isContained=true;
- break;
- }elseif(!tempItems.get(0).equals("_")){
- //从没有_前缀的项集开始寻找,第二种为从后面的后缀中找出直接找出连续字符为ab为同一项集的项集
- if(strArrayContains(tempItems,itemSet.getItems())){
- isContained=true;
- break;
- }
- }
- if(isContained){
- break;
- }
- }
- returnisContained;
- }
- /**
- *删除单个项
- *
- *@params
- *待删除项
- */
- publicvoiddeleteSingleItem(Strings){
- ArrayList<String>tempItems;
- ArrayList<String>deleteItems=newArrayList<>();
- for(ItemSetitemSet:this.itemSetList){
- tempItems=itemSet.getItems();
- deleteItems=newArrayList<>();
- for(inti=0;i<tempItems.size();i++){
- if(tempItems.get(i).equals(s)){
- deleteItems.add(tempItems.get(i));
- }
- }
- tempItems.removeAll(deleteItems);
- }
- }
- /**
- *提取项s之后所得的序列
- *
- *@params
- *目标提取项s
- */
- publicSequenceextractItem(Strings){
- SequenceextractSeq=this.copySeqence();
- ItemSetitemSet;
- ArrayList<String>items;
- ArrayList<ItemSet>deleteItemSets=newArrayList<>();
- ArrayList<String>tempItems=newArrayList<>();
- for(intk=0;k<extractSeq.itemSetList.size();k++){
- itemSet=extractSeq.itemSetList.get(k);
- items=itemSet.getItems();
- if(items.size()==1&&items.get(0).equals(s)){
- //如果找到的是单项,则完全移除,跳出循环
- extractSeq.itemSetList.remove(k);
- break;
- }elseif(items.size()>1&&!items.get(0).equals("_")){
- //在后续的多元素项中判断是否包含此元素
- if(items.contains(s)){
- //如果包含把s后面的元素加入到临时字符数组中
- intindex=items.indexOf(s);
- for(intj=index;j<items.size();j++){
- tempItems.add(items.get(j));
- }
- //将第一位的s变成下标符"_"
- tempItems.set(0,"_");
- if(tempItems.size()==1){
- //如果此匹配为在最末端,同样移除
- deleteItemSets.add(itemSet);
- }else{
- //将变化后的项集替换原来的
- extractSeq.itemSetList.set(k,newItemSet(tempItems));
- }
- break;
- }else{
- deleteItemSets.add(itemSet);
- }
- }else{
- //不符合以上2项条件的统统移除
- deleteItemSets.add(itemSet);
- }
- }
- extractSeq.itemSetList.removeAll(deleteItemSets);
- returnextractSeq;
- }
- /**
- *提取组合项之后的序列
- *
- *@paramarray
- *组合数组
- *@return
- */
- publicSequenceextractCompoentItem(ArrayList<String>array){
- //找到目标项,是否立刻停止
- booleanstopExtract=false;
- Sequenceseq=this.copySeqence();
- StringlastItem=array.get(array.size()-1);
- ArrayList<String>tempItems;
- ArrayList<ItemSet>deleteItems=newArrayList<>();
- for(inti=0;i<seq.itemSetList.size();i++){
- if(stopExtract){
- break;
- }
- tempItems=seq.itemSetList.get(i).getItems();
- //分2种情况查找,第一种从_X中找出x等于项集最后的元素,因为_前缀已经为原本的元素
- if(tempItems.size()>1&&tempItems.get(0).equals("_")
- &&tempItems.get(1).equals(lastItem)){
- if(tempItems.size()==2){
- seq.itemSetList.remove(i);
- }else{
- //把1号位置变为下标符"_",往后移1个字符的位置
- tempItems.set(1,"_");
- //移除第一个的"_"下划符
- tempItems.remove(0);
- }
- stopExtract=true;
- break;
- }elseif(!tempItems.get(0).equals("_")){
- //从没有_前缀的项集开始寻找,第二种为从后面的后缀中找出直接找出连续字符为ab为同一项集的项集
- if(strArrayContains(tempItems,array)){
- //从左往右找出第一个给定字符的位置,把后面的部分截取出来
- intindex=tempItems.indexOf(lastItem);
- ArrayList<String>array2=newArrayList<String>();
- for(intj=index;j<tempItems.size();j++){
- array2.add(tempItems.get(j));
- }
- array2.set(0,"_");
- if(array2.size()==1){
- //如果此项在末尾的位置,则移除该项,否则进行替换
- deleteItems.add(seq.itemSetList.get(i));
- }else{
- seq.itemSetList.set(i,newItemSet(array2));
- }
- stopExtract=true;
- break;
- }else{
- deleteItems.add(seq.itemSetList.get(i));
- }
- }else{
- //这种情况是处理_X中X不等于最后一个元素的情况
- deleteItems.add(seq.itemSetList.get(i));
- }
- }
- seq.itemSetList.removeAll(deleteItems);
- returnseq;
- }
- /**
- *深拷贝一个序列
- *
- *@return
- */
- publicSequencecopySeqence(){
- SequencecopySeq=newSequence();
- ItemSettempItemSet;
- ArrayList<String>items;
- for(ItemSetitemSet:this.itemSetList){
- items=(ArrayList<String>)itemSet.getItems().clone();
- tempItemSet=newItemSet(items);
- copySeq.getItemSetList().add(tempItemSet);
- }
- returncopySeq;
- }
- /**
- *获取序列中最后一个项集的最后1个元素
- *
- *@return
- */
- publicStringgetLastItemSetValue(){
- intsize=this.getItemSetList().size();
- ItemSetitemSet=this.getItemSetList().get(size-1);
- size=itemSet.getItems().size();
- returnitemSet.getItems().get(size-1);
- }
- /**
- *判断strList2是否是strList1的子序列
- *
- *@paramstrList1
- *@paramstrList2
- *@return
- */
- publicbooleanstrArrayContains(ArrayList<String>strList1,
- ArrayList<String>strList2){
- booleanisContained=false;
- for(inti=0;i<strList1.size()-strList2.size()+1;i++){
- isContained=true;
- for(intj=0,k=i;j<strList2.size();j++,k++){
- if(!strList1.get(k).equals(strList2.get(j))){
- isContained=false;
- break;
- }
- }
- if(isContained){
- break;
- }
- }
- returnisContained;
- }
- }
- packageDataMining_PrefixSpan;
- importjava.util.ArrayList;
- /**
- *字符项集类
- *
- *@authorlyq
- *
- */
- publicclassItemSet{
- //项集内的字符
- privateArrayList<String>items;
- publicItemSet(String[]str){
- items=newArrayList<>();
- for(Strings:str){
- items.add(s);
- }
- }
- publicItemSet(ArrayList<String>itemsList){
- this.items=itemsList;
- }
- publicItemSet(Strings){
- items=newArrayList<>();
- for(inti=0;i<s.length();i++){
- items.add(s.charAt(i)+"");
- }
- }
- publicArrayList<String>getItems(){
- returnitems;
- }
- publicvoidsetItems(ArrayList<String>items){
- this.items=items;
- }
- /**
- *获取项集最后1个元素
- *
- *@return
- */
- publicStringgetLastValue(){
- intsize=this.items.size();
- returnthis.items.get(size-1);
- }
- }
- packageDataMining_PrefixSpan;
- importjava.io.BufferedReader;
- importjava.io.File;
- importjava.io.FileReader;
- importjava.io.IOException;
- importjava.util.ArrayList;
- importjava.util.Collections;
- importjava.util.HashMap;
- importjava.util.Map;
- /**
- *PrefixSpanTool序列模式分析算法工具类
- *
- *@authorlyq
- *
- */
- publicclassPrefixSpanTool{
- //测试数据文件地址
- privateStringfilePath;
- //最小支持度阈值比例
- privatedoubleminSupportRate;
- //最小支持度,通过序列总数乘以阈值比例计算
- privateintminSupport;
- //原始序列组
- privateArrayList<Sequence>totalSeqs;
- //挖掘出的所有序列频繁模式
- privateArrayList<Sequence>totalFrequentSeqs;
- //所有的单一项,用于递归枚举
- privateArrayList<String>singleItems;
- publicPrefixSpanTool(StringfilePath,doubleminSupportRate){
- this.filePath=filePath;
- this.minSupportRate=minSupportRate;
- readDataFile();
- }
- /**
- *从文件中读取数据
- */
- privatevoidreadDataFile(){
- Filefile=newFile(filePath);
- ArrayList<String[]>dataArray=newArrayList<String[]>();
- try{
- BufferedReaderin=newBufferedReader(newFileReader(file));
- Stringstr;
- String[]tempArray;
- while((str=in.readLine())!=null){
- tempArray=str.split("");
- dataArray.add(tempArray);
- }
- in.close();
- }catch(IOExceptione){
- e.getStackTrace();
- }
- minSupport=(int)(dataArray.size()*minSupportRate);
- totalSeqs=newArrayList<>();
- totalFrequentSeqs=newArrayList<>();
- SequencetempSeq;
- ItemSettempItemSet;
- for(String[]str:dataArray){
- tempSeq=newSequence();
- for(Strings:str){
- tempItemSet=newItemSet(s);
- tempSeq.getItemSetList().add(tempItemSet);
- }
- totalSeqs.add(tempSeq);
- }
- System.out.println("原始序列数据:");
- outputSeqence(totalSeqs);
- }
- /**
- *输出序列列表内容
- *
- *@paramseqList
- *待输出序列列表
- */
- privatevoidoutputSeqence(ArrayList<Sequence>seqList){
- for(Sequenceseq:seqList){
- System.out.print("<");
- for(ItemSetitemSet:seq.getItemSetList()){
- if(itemSet.getItems().size()>1){
- System.out.print("(");
- }
- for(Strings:itemSet.getItems()){
- System.out.print(s+"");
- }
- if(itemSet.getItems().size()>1){
- System.out.print(")");
- }
- }
- System.out.println(">");
- }
- }
- /**
- *移除初始序列中不满足最小支持度阈值的单项
- */
- privatevoidremoveInitSeqsItem(){
- intcount=0;
- HashMap<String,Integer>itemMap=newHashMap<>();
- singleItems=newArrayList<>();
- for(Sequenceseq:totalSeqs){
- for(ItemSetitemSet:seq.getItemSetList()){
- for(Strings:itemSet.getItems()){
- if(!itemMap.containsKey(s)){
- itemMap.put(s,1);
- }
- }
- }
- }
- Stringkey;
- for(Map.Entryentry:itemMap.entrySet()){
- count=0;
- key=(String)entry.getKey();
- for(Sequenceseq:totalSeqs){
- if(seq.strIsContained(key)){
- count++;
- }
- }
- itemMap.put(key,count);
- }
- for(Map.Entryentry:itemMap.entrySet()){
- key=(String)entry.getKey();
- count=(int)entry.getValue();
- if(count<minSupport){
- //如果支持度阈值小于所得的最小支持度阈值,则删除该项
- for(Sequenceseq:totalSeqs){
- seq.deleteSingleItem(key);
- }
- }else{
- singleItems.add(key);
- }
- }
- Collections.sort(singleItems);
- }
- /**
- *递归搜索满足条件的序列模式
- *
- *@parambeforeSeq
- *前缀序列
- *@paramafterSeqList
- *后缀序列列表
- */
- privatevoidrecursiveSearchSeqs(SequencebeforeSeq,
- ArrayList<Sequence>afterSeqList){
- ItemSettempItemSet;
- SequencetempSeq2;
- SequencetempSeq;
- ArrayList<Sequence>tempSeqList=newArrayList<>();
- for(Strings:singleItems){
- //分成2种形式递归,以<a>为起始项,第一种直接加入独立项集遍历<a,a>,<a,b><a,c>..
- if(isLargerThanMinSupport(s,afterSeqList)){
- tempSeq=beforeSeq.copySeqence();
- tempItemSet=newItemSet(s);
- tempSeq.getItemSetList().add(tempItemSet);
- totalFrequentSeqs.add(tempSeq);
- tempSeqList=newArrayList<>();
- for(Sequenceseq:afterSeqList){
- if(seq.strIsContained(s)){
- tempSeq2=seq.extractItem(s);
- tempSeqList.add(tempSeq2);
- }
- }
- recursiveSearchSeqs(tempSeq,tempSeqList);
- }
- //第二种递归为以元素的身份加入最后的项集内以a为例<(aa)>,<(ab)>,<(ac)>...
- //a在这里可以理解为一个前缀序列,里面可能是单个元素或者已经是多元素的项集
- tempSeq=beforeSeq.copySeqence();
- intsize=tempSeq.getItemSetList().size();
- tempItemSet=tempSeq.getItemSetList().get(size-1);
- tempItemSet.getItems().add(s);
- if(isLargerThanMinSupport(tempItemSet,afterSeqList)){
- tempSeqList=newArrayList<>();
- for(Sequenceseq:afterSeqList){
- if(seq.compoentItemIsContain(tempItemSet)){
- tempSeq2=seq.extractCompoentItem(tempItemSet
- .getItems());
- tempSeqList.add(tempSeq2);
- }
- }
- totalFrequentSeqs.add(tempSeq);
- recursiveSearchSeqs(tempSeq,tempSeqList);
- }
- }
- }
- /**
- *所传入的项组合在所给定序列中的支持度是否超过阈值
- *
- *@params
- *所需匹配的项
- *@paramseqList
- *比较序列数据
- *@return
- */
- privatebooleanisLargerThanMinSupport(Strings,ArrayList<Sequence>seqList){
- booleanisLarge=false;
- intcount=0;
- for(Sequenceseq:seqList){
- if(seq.strIsContained(s)){
- count++;
- }
- }
- if(count>=minSupport){
- isLarge=true;
- }
- returnisLarge;
- }
- /**
- *所传入的组合项集在序列中的支持度是否大于阈值
- *
- *@paramitemSet
- *组合元素项集
- *@paramseqList
- *比较的序列列表
- *@return
- */
- privatebooleanisLargerThanMinSupport(ItemSetitemSet,
- ArrayList<Sequence>seqList){
- booleanisLarge=false;
- intcount=0;
- if(seqList==null){
- returnfalse;
- }
- for(Sequenceseq:seqList){
- if(seq.compoentItemIsContain(itemSet)){
- count++;
- }
- }
- if(count>=minSupport){
- isLarge=true;
- }
- returnisLarge;
- }
- /**
- *序列模式分析计算
- */
- publicvoidprefixSpanCalculate(){
- Sequenceseq;
- SequencetempSeq;
- ArrayList<Sequence>tempSeqList=newArrayList<>();
- ItemSetitemSet;
- removeInitSeqsItem();
- for(Strings:singleItems){
- //从最开始的a,b,d开始递归往下寻找频繁序列模式
- seq=newSequence();
- itemSet=newItemSet(s);
- seq.getItemSetList().add(itemSet);
- if(isLargerThanMinSupport(s,totalSeqs)){
- tempSeqList=newArrayList<>();
- for(Sequences2:totalSeqs){
- //判断单一项是否包含于在序列中,包含才进行提取操作
- if(s2.strIsContained(s)){
- tempSeq=s2.extractItem(s);
- tempSeqList.add(tempSeq);
- }
- }
- totalFrequentSeqs.add(seq);
- recursiveSearchSeqs(seq,tempSeqList);
- }
- }
- printTotalFreSeqs();
- }
- /**
- *按模式类别输出频繁序列模式
- */
- privatevoidprintTotalFreSeqs(){
- System.out.println("序列模式挖掘结果:");
- ArrayList<Sequence>seqList;
- HashMap<String,ArrayList<Sequence>>seqMap=newHashMap<>();
- for(Strings:singleItems){
- seqList=newArrayList<>();
- for(Sequenceseq:totalFrequentSeqs){
- if(seq.getItemSetList().get(0).getItems().get(0).equals(s)){
- seqList.add(seq);
- }
- }
- seqMap.put(s,seqList);
- }
- intcount=0;
- for(Strings:singleItems){
- count=0;
- System.out.println();
- System.out.println();
- seqList=(ArrayList<Sequence>)seqMap.get(s);
- for(SequencetempSeq:seqList){
- count++;
- System.out.print("<");
- for(ItemSetitemSet:tempSeq.getItemSetList()){
- if(itemSet.getItems().size()>1){
- System.out.print("(");
- }
- for(Stringstr:itemSet.getItems()){
- System.out.print(str+"");
- }
- if(itemSet.getItems().size()>1){
- System.out.print(")");
- }
- }
- System.out.print(">,");
- //每5个序列换一行
- if(count==5){
- count=0;
- System.out.println();
- }
- }
- }
- }
- }
- packageDataMining_PrefixSpan;
- /**
- *PrefixSpan序列模式挖掘算法
- *@authorlyq
- *
- */
- publicclassClient{
- publicstaticvoidmain(String[]agrs){
- StringfilePath="C:\\Users\\lyq\\Desktop\\icon\\input.txt";
- //最小支持度阈值率
- doubleminSupportRate=0.4;
- PrefixSpanTooltool=newPrefixSpanTool(filePath,minSupportRate);
- tool.prefixSpanCalculate();
- }
- }
- 原始序列数据:
- <(bd)cb(ac)>
- <(bf)(ce)b(fg)>
- <(ah)(bf)abf>
- <(be)(ce)d>
- <a(bd)bcb(ade)>
- 序列模式挖掘结果:
- <a>,<aa>,<ab>,<aba>,<abb>,
- <b>,<ba>,<bb>,<bba>,<bbc>,
- <bbf>,<bc>,<bca>,<bcb>,<bcba>,
- <bcd>,<b(ce)>,<bd>,<(bd)>,<(bd)a>,
- <(bd)b>,<(bd)ba>,<(bd)bc>,<(bd)c>,<(bd)ca>,
- <(bd)cb>,<(bd)cba>,<be>,<bf>,<(bf)>,
- <(bf)b>,<(bf)bf>,<(bf)f>,
- <c>,<ca>,<cb>,<cba>,<cd>,
- <(ce)>,
- <d>,<da>,<db>,<dba>,<dbc>,
- <dc>,<dca>,<dcb>,<dcba>,
- <e>,
- <f>,<fb>,<fbf>,<ff>,
算法实现时的难点
我在实现这个算法时确实碰到了不少的问题,下面一一列举。
1、Sequence序列在判断或者提取单项和组合项的时候,情况少考虑了,还有考虑到了处理的方式又可能错了。
2、递归的顺序在最早的时候考虑错了,后来对递归的顺序进行了调整。
3、在算法的调试时遇到了,当发现某一项出现问题时,不能够立即调试,因为里面陷入的递归层次实在太深,只能自己先手算此情况下的前缀,后缀序列,然后自己模拟出1个Seq调试,在纠正extract方法时用的比较多。
我对PrefixSpan算法的理解
实现了这个算法之后,再回味这个算法,还是很奇妙的,一个序列,通过从左往右的扫描,通过各个项集的子集,能够组合出许许多多的的序列模式,然后进行挖掘,PrefixSpan通过递归的形式全部找出,而且效率非常高,的确是个很强大的算法。
PrefixSpan算法整体的特点
首先一点,他不会产生候选序列,在产生投影数据库的时候(也就是产生后缀子序列),他的规模是不断减小的。PrefixSpan采用分治法进行序列的挖掘,十分的高效。唯一比较会有影响的开销就是在构造后缀子序列的过程,专业上的名称叫做构造投影数据库的时候。