亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? totalsupporttree.java

?? apriori algorithm using datasets implementation
?? JAVA
?? 第 1 頁 / 共 3 頁
字號:
/* ------------------------------------------------------------------------- */
/*                                                                           */
/*                             TOTAL SUPPORT TREE                            */
/*                                                                           */
/*                                Frans Coenen                               */
/*                                                                           */
/*                               10 January 2003                             */
/*        (Revised 23/1/3003, 8/2/2003, 18/3/2003, 3/3/2003. 7/4/2004)       */
/*                                                                           */
/*                       Department of Computer Science                      */
/*                         The University of Liverpool                       */
/*                                                                           */ 
/* ------------------------------------------------------------------------- */

/* Structure:

AssocRuleMining
      |
      +-- TotalSupportTree	 */ 

/* Java packages */
import java.io.*;
import java.util.*;

/** Methods concerned with the generation, processing and manipulation of 
T-tree data storage structures used to hold the total support counts for large 
itemsets.
@author Frans Coenen
@version 3 July 2003 */

public class TotalSupportTree extends AssocRuleMining {

    /* ------ FIELDS ------ */
	
    // Data structures    
    /** The reference to start of t-tree. */
    protected TtreeNode[] startTtreeRef;	 
    
    // Constants
    /** The maximum number of frequent sets that may be generated. */
    protected final int MAX_NUM_FREQUENT_SETS = 80000;
    
    // Other fields     
    /** The next level indicator flag: set to <TT>true</TT> if new level 
    generated and by default. */
    protected boolean nextLevelExists = true ; 
    /** Instance of the calss RuleList */
    protected RuleList currentRlist = null;

    // Diagnostics 
    /** The number of frequent sets (nodes in t-tree with above minimum 
    support) generated so far. */
    protected int numFrequentsets =0;
    /** The number of updates required to generate the T-tree. */
    protected long numUpdates   = 0l;
    
    /* ------ CONSTRUCTORS ------ */

    /** Processes command line arguments. */
    
    public TotalSupportTree(String[] args) {
	super(args);
	// Create RuleList object for later usage
	currentRlist = new RuleList();
	}
	
    /* ------ METHODS ------ */
    
    /*----------------------------------------------------------------------- */
    /*                                                                        */
    /*                       T-TREE BUILDING METHODS                          */
    /*                                                                        */
    /*----------------------------------------------------------------------- */
    
    /* CREATE TOTAL SUPPORT TREE */
    /** Commences process of generating a total support tree (T-tree). */
                
    public void createTotalSupportTree() {	
	System.out.println("APRIORI-T WITH X-CHECKING\n" +
	                   "-------------------------");
	System.out.println("Minimum support threshold = " + 
				twoDecPlaces(support) + "% " + "(" + 
				twoDecPlaces(minSupport) + " records)");
        
	// If no data (possibly as a result of an order and pruning operation)
	// return
	if (numOneItemSets==0) return;
	
	// Set RuleList conversion and reconversion values so that they are the
	// same as those inherited from AssocRuleMining class
	currentRlist.setReconversionArrayRefs(conversionArray,reconversionArray);
	
	// Create Top level of T-tree (First pass of dataset)	
	startTtreeRef   = null;
	numFrequentsets = 0;
	numUpdates      = 0l;
	createTtreeTopLevel();
	
	// Generate level 2
	generateLevel2();
	
	// Further passes of the dataset	
	createTtreeLevelN();
	}
	
    /* CREATE T-TREE TOP LEVEL */
    /** Generates level 1 (top) of the T-tree. */
    		
    protected void createTtreeTopLevel() {
        
	// Dimension and initialise top level of T-tree	
	startTtreeRef = new TtreeNode[numOneItemSets+1];
	for (int index=1;index<=numOneItemSets;index++) 
	    			startTtreeRef[index] = new TtreeNode();
	    
        // Add support for each 1 itemset
	createTtreeTopLevel2();

	// Prune top level, setting any unsupported 1-itemsets to null 
	pruneLevelN(startTtreeRef,1); 
	}
    
    /* CREATE T-TREE TOP LEVEL 2 */	
    /** Adds supports to level 1 (top) of the T-tree. */
    	
    protected void createTtreeTopLevel2() {
	    
        // Loop through data set record by record and add support for each
	// 1 itemset
        
	for (int index1=0;index1<dataArray.length;index1++) {
	    // Non null record (if initial data set has been reordered and
	    // pruned some records may be empty!
	    if (dataArray[index1] != null) {
    	        for (int index2=0;index2<dataArray[index1].length;index2++) {
		    startTtreeRef[dataArray[index1][index2]].support++; 
		    numUpdates++;
		    }
		}
	    }
	}	
	
    /* CREATE T-TREE LEVEL N */ 
    /** Commences the process of determining the remaining levels in the T-tree
    (other than the top level), level by level in an "Apriori" manner. <P>
    Follows an add support, prune, generate loop until there are no more levels 
    to generate. */
    
    protected void createTtreeLevelN() {
        int nextLevel=2;
   	
	// Loop while a further level exists
	
	while (nextLevelExists) { 	    
            // Add support
	    addSupportToTtreeLevelN(nextLevel);
	    // Prune unsupported candidate sets
	    pruneLevelN(startTtreeRef,nextLevel);
	    // Check number of frequent sets generated so far
	    if (numFrequentsets>MAX_NUM_FREQUENT_SETS) {
	        System.out.println("Number of frequent sets (" +
				numFrequentsets + ") generted so far " + 
				"exceeds limit of " + MAX_NUM_FREQUENT_SETS +
				", generation process stopped!");
		break;	
		}
	    // Attempt to generate next level 
	    nextLevelExists=false;
	    generateLevelN(startTtreeRef,nextLevel,null); 
	    nextLevel++;
	    }
	    
	//End
	System.out.println("Levels in T-tree = " + nextLevel);  
	}
 
    /* ------------------------------------ */
    /* ADD SUPPORT VALUES TO T-TREE LEVEL N */  
    /* ------------------------------------ */  
    /** Commences process of adding support to a given level in the T-tree 
    (other than the top level). 
    @param level the current level number (top level = 1). */
     	
    protected void addSupportToTtreeLevelN(int level) {
	// Loop through data set record by record
        for (int index=0;index<dataArray.length;index++) {
	    // Non null record (if initial data set has been reordered and
	    // pruned some records may be empty
	    if (dataArray[index] != null) 
	        		addSupportToTtreeFindLevel(startTtreeRef,level,
				dataArray[index].length,dataArray[index]);
	    }
	} 
	
    /* ADD SUPPORT TO T-TREE FIND LEVEL */    
    /** Adds support to a given level in the T-tree (other than the top level).
    <P> Operates in a recursive manner to first find the appropriate level in 
    the T-tree before processing the required level (when found). 
    @param linkRef the reference to the current sub-branch of T-tree (start at 
    top of tree)
    @param level the level marker, set to the required level at the start and 
    then decremented by 1 on each recursion. 
    @param endIndex the length of current level in a sub-branch of the T-tree.
    @param itemSet the current itemset under consideration. */
    
    protected void addSupportToTtreeFindLevel(TtreeNode[] linkRef, int level, 
    			int endIndex, short[] itemSet) {

	// At right level;
	
	if (level == 1) {
	    // Step through itemSet
	    for (int index1=0;index1 < endIndex;index1++) {
		// If valid node update, i.e. a non null node
		if (linkRef[itemSet[index1]] != null) {
		    linkRef[itemSet[index1]].support++; 
		    numUpdates++;
		    }
		}
	    }
	
	// At wrong level
	
	else {
	    // Step through itemSet
	    for (int index=level-1;index<endIndex;index++) {		
		// If child branch step down branch
		if (linkRef[itemSet[index]] != null) {
		    if (linkRef[itemSet[index]].childRef != null) 
		    	 addSupportToTtreeFindLevel(linkRef[itemSet[index]].childRef,
						level-1,index,itemSet);
		    }
		}
	    }	
	}
	
    /*---------------------------------------------------------------------- */
    /*                                                                       */
    /*                                 PRUNING                               */
    /*                                                                       */
    /*---------------------------------------------------------------------- */ 
    
    /* PRUNE LEVEL N */
    
    /** Prunes the given level in the T-tree. <P> Operates in a recursive 
    manner to first find the appropriate level in the T-tree before processing 
    the required level (when found). Pruning carried out according to value of
    <TT>minSupport</TT> field.
    @param linkRef The reference to the current sub-branch of T-tree (start at 
    top of tree)
    @param level the level marker, set to the required level at the start and 
    then decremented by 1 on each recursion. 
    @return true if all nodes at a given level in the given branch of the 
    T-tree have been pruned, false otherwise. */
    
    protected boolean pruneLevelN(TtreeNode [] linkRef, int level) {
        int size = linkRef.length;
	
	// At right level;	
	if (level == 1) {
	    boolean allUnsupported = true;
	    // Step through level and set to null where below min support
	    for (int index1=1;index1<size;index1++) {
	        if (linkRef[index1] != null) {
	            if (linkRef[index1].support < minSupport) 
		    		linkRef[index1] = null;
	            else {
		        numFrequentsets++;
			allUnsupported = false;
			}
		    }
		}
	    return(allUnsupported);
	    }
	    	
	// Wrong level, Step through row
	for (int index1=level;index1<size;index1++) {
	    if (linkRef[index1] != null) {		
		// If child branch step down branch
		if (linkRef[index1].childRef != null) {
		    if (pruneLevelN(linkRef[index1].childRef,level-1)) 
			    		linkRef[index1].childRef=null;
		    }
		}
	    }	
	return(false);
	}
					
    /*---------------------------------------------------------------------- */
    /*                                                                       */
    /*                            LEVEL GENERATION                           */
    /*                                                                       */
    /*---------------------------------------------------------------------- */ 
    
    /* GENERATE LEVEL 2 */
    
    /** Generates level 2 of the T-tree. <P> The general 
    <TT>generateLevelN</TT> method assumes we have to first find the right 
    level in the T-tree, that is not necessary in this case of level 2. */
    
    protected void generateLevel2() {	    
	
	// Set next level flag	
	nextLevelExists=false;
	
	// loop through top level	
	for (int index=2;index<startTtreeRef.length;index++) {
	    // If supported T-tree node (i.e. it exists)
	    if (startTtreeRef[index] != null) generateNextLevel(startTtreeRef,
	    				index,realloc2(null,(short) index));	
	    }
	}
	
    /* GENERATE LEVEL N */
    
    /** Commences process of generating remaining levels in the T-tree (other 
    than top and 2nd levels). <P> Proceeds in a recursive manner level by level
    until the required level is reached. Example, if we have a T-tree of the form:
    
    <PRE>
    (A) ----- (B) ----- (C)
               |         |
	       |         |
	      (A)       (A) ----- (B)
    </PRE><P>	                           
    Where all nodes are supported and we wish to add the third level we would
    walk the tree and attempt to add new nodes to every level 2 node found.
    Having found the correct level we step through starting from B (we cannot
    add a node to A), so in this case there is only one node from which a level
    3 node may be attached. 
    @param linkRef the reference to the current sub-branch of T-tree (start at 
    top of tree).
    @param level the level marker, set to the required level at the start and
    then decremented by 1 on each recursion.
    @param itemSet the current itemset under consideration. */
    
    protected void generateLevelN(TtreeNode[] linkRef, int level, 
    							short[] itemSet) {
	int index1;
	int localSize = linkRef.length;
	
	// Correct level
	
	if (level == 1) {
	    for (index1=2;index1<localSize;index1++) {
	        // If supported T-tree node
	    	if (linkRef[index1] != null) generateNextLevel(linkRef,index1,
					realloc2(itemSet,(short) index1));		
	        }
	    }
	
	// Wrong level
	
	else {
		
	    for (index1=level;index1<localSize;index1++) {
	        // If supported T-tree node
	        if (linkRef[index1]!=null && linkRef[index1].childRef!=null) {
		    generateLevelN(linkRef[index1].childRef,level-1,
		    			realloc2(itemSet,(short) index1));
		    }	
		}
	    }
	}

    /* GENERATE NEXT LEVEL */
    
    /** Generates a new level in the T-tree from a given "parent" node. <P> 
    Example 1, given the following:
    
    <PRE>
    (A) ----- (B) ----- (C)
               |         |
	       |         |
	      (A)       (A) ----- (B) 
    </PRE><P>	      
    where we wish to add a level 3 node to node (B), i.e. the node {A}, we 
    would proceed as follows:
    <OL>
    <LI> Generate a new level in the T-tree attached to node (B) of length 
    one less than the numeric equivalent of B i.e. 2-1=1.
    <LI> Loop through parent level from (A) to node immediately before (B). 
    <LI> For each supported parent node create an itemset label by combing the
    index of the parent node (e.g. A) with the complete itemset label for B --- 
    {C,B} (note reverse order), thus for parent node (B) we would get a new
    level in the T-tree with one node in it --- {C,B,A} represented as A.
    <LI> For this node to be a candidate large item set its size-1 subsets must 
    be supported, there are three of these in this example {C,A}, {C,B} and
    {B,A}. We know that the first two are supported because they are in the
    current branch, but {B,A} is in another branch. So we must generate this

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产大陆亚洲精品国产| 亚洲天天做日日做天天谢日日欢| 亚洲国产中文字幕在线视频综合| 色婷婷av久久久久久久| 夜夜精品视频一区二区| 在线观看欧美日本| 日韩精品免费专区| 337p粉嫩大胆色噜噜噜噜亚洲| 国产一区免费电影| 亚洲欧美怡红院| 制服丝袜亚洲色图| 国产精品资源在线观看| 亚洲欧美另类在线| 欧美一级欧美三级| 国产福利视频一区二区三区| 亚洲视频你懂的| 日韩一区二区电影| 成人激情小说网站| 日韩经典一区二区| 国产精品三级视频| 欧美日韩亚洲综合一区| 国产一区二区福利视频| 亚洲美女免费在线| 日韩免费看的电影| 色综合欧美在线视频区| 国产日韩影视精品| 亚洲精品精品亚洲| av在线这里只有精品| 欧美性淫爽ww久久久久无| 精品国产乱码久久久久久1区2区| 亚洲成人黄色小说| 日日骚欧美日韩| 午夜欧美在线一二页| 欧美va亚洲va在线观看蝴蝶网| 中文字幕一区二| 国产69精品久久久久毛片| 精品久久久久久最新网址| 午夜精品福利一区二区三区蜜桃| 制服丝袜日韩国产| 国产91丝袜在线18| 国产日韩欧美一区二区三区乱码 | 亚洲国产精品一区二区久久| 亚洲日本免费电影| 一区二区成人在线观看| 国产剧情在线观看一区二区| 91精品国产免费| 亚洲欧美怡红院| 51精品视频一区二区三区| 麻豆91精品91久久久的内涵| 国产日韩影视精品| 欧美情侣在线播放| 成人黄色在线看| 国产综合久久久久久鬼色| 欧美一区二区三区色| 国产高清精品久久久久| 国产精品理论片| 成人黄色免费短视频| 亚洲午夜久久久久久久久电影院| 欧美三级中文字| 亚洲国产成人porn| 欧美一区二区三区啪啪| 亚洲曰韩产成在线| 色婷婷综合久久久久中文| 一区二区三区精品视频在线| 国产美女在线观看一区| 精品国产一区二区在线观看| 亚洲国产综合在线| 欧美日韩成人一区二区| 国产精品久久久久久久久久久免费看 | 亚洲高清视频中文字幕| 91精品福利在线一区二区三区 | 久久久国产午夜精品| 成人性生交大片免费看在线播放| 国产精品每日更新| 国产99久久久国产精品潘金| 精品无码三级在线观看视频| 日韩av一区二区三区| 亚洲高清免费在线| 香港成人在线视频| 视频一区视频二区在线观看| 亚洲成人av在线电影| 亚洲aⅴ怡春院| 日本一道高清亚洲日美韩| 日韩精品福利网| 青青国产91久久久久久| 久久爱www久久做| 国产很黄免费观看久久| www.欧美精品一二区| 在线影视一区二区三区| 精品视频1区2区| 欧美一区二区三区视频在线| 久久亚洲一区二区三区明星换脸| 国产亚洲欧美中文| 亚洲欧美激情视频在线观看一区二区三区 | 一区二区三区欧美在线观看| 亚洲一区二区在线观看视频| 日韩国产在线观看| 精品亚洲国产成人av制服丝袜| 国产一区三区三区| 99国产精品久久久久久久久久| 欧美性淫爽ww久久久久无| 91麻豆精品国产91久久久更新时间 | 欧美性三三影院| 日韩写真欧美这视频| 久久久久久久久久电影| 亚洲欧美日韩国产综合| 轻轻草成人在线| 成人激情午夜影院| 欧美精品在线观看一区二区| 久久综合999| 一区二区三区电影在线播| 久久99国内精品| 91捆绑美女网站| 日韩精品中文字幕在线不卡尤物| 国产精品理论片在线观看| 亚洲成精国产精品女| 丁香网亚洲国际| 这里只有精品电影| 国产午夜精品一区二区 | 欧美一级在线免费| 国产精品丝袜一区| 蜜桃视频一区二区三区| va亚洲va日韩不卡在线观看| 3d动漫精品啪啪| 亚洲女同ⅹxx女同tv| 精品一区二区三区免费毛片爱| 91网上在线视频| 欧美不卡一区二区| 亚洲成人第一页| 91影视在线播放| 精品国产乱码久久久久久牛牛| 亚洲美女淫视频| 国产a久久麻豆| 日韩精品一区国产麻豆| 亚洲一区电影777| 成人av电影免费观看| 久久久美女艺术照精彩视频福利播放| 亚洲二区在线观看| 91网址在线看| 中文字幕免费不卡在线| 久久超碰97中文字幕| 欧美性高清videossexo| 日韩伦理av电影| 成人黄色电影在线| 国产欧美一二三区| 国内精品自线一区二区三区视频| 欧美老女人第四色| 亚洲综合一区二区三区| 91猫先生在线| 亚洲欧美在线aaa| 亚洲bdsm女犯bdsm网站| 欧美一区二区黄色| 亚洲国产视频在线| 欧美肥妇free| 精品一区二区影视| 国产女主播视频一区二区| 国产一区二区免费看| 一级做a爱片久久| 日韩欧美精品在线视频| 国产99一区视频免费| 自拍偷拍国产亚洲| 欧美精品 日韩| 韩国三级在线一区| 国产午夜精品久久| 色综合一个色综合| 日韩黄色免费电影| 国产精品久久久久久久久图文区 | 日本欧美加勒比视频| 日韩午夜中文字幕| 国产成人综合亚洲网站| 亚洲人一二三区| 日韩一级黄色片| 91黄色免费看| 国产99久久久久| 亚洲自拍偷拍九九九| 日韩手机在线导航| 在线免费观看日韩欧美| 精品一区二区日韩| 一区二区不卡在线播放 | 精品乱人伦小说| 日韩欧美视频在线| 成人午夜大片免费观看| 国产日韩欧美麻豆| 欧美色视频在线| 色婷婷综合久久| 成人一区二区三区| 91视频com| 亚洲免费在线观看| 色诱视频网站一区| 亚洲精品久久嫩草网站秘色| 久久66热偷产精品| 国产精品乱码一区二三区小蝌蚪| av亚洲产国偷v产偷v自拍| 亚洲愉拍自拍另类高清精品| 日韩一区二区视频| 国产乱子伦一区二区三区国色天香| 国产精品午夜久久| 欧美日本一道本在线视频| 国产一区二区伦理| 亚洲国产精品自拍|