亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
国产精品大尺度| 日本一道高清亚洲日美韩| 久久嫩草精品久久久精品一| 久久久国际精品| 久久久久高清精品| 国产精品三级在线观看| 亚洲精品高清在线| 久久99热这里只有精品| 色综合天天综合网天天狠天天| 一本大道久久a久久综合婷婷| 欧美色男人天堂| 国产精品日日摸夜夜摸av| 一级日本不卡的影视| 久久草av在线| aaa国产一区| 91蝌蚪porny九色| 精品国产伦一区二区三区观看体验| 国产亚洲一二三区| 日韩av午夜在线观看| 一本到不卡精品视频在线观看 | 久久99久久精品| av在线不卡免费看| 欧美一卡二卡三卡| 一区二区三区四区视频精品免费 | 精品捆绑美女sm三区| 伊人开心综合网| 粉嫩一区二区三区在线看| 欧美电影一区二区| 中文字幕精品一区二区三区精品| 亚洲午夜精品17c| 成人激情动漫在线观看| 日韩欧美国产麻豆| 日韩电影在线免费| 91视频在线观看免费| 国产午夜一区二区三区| 男人的天堂亚洲一区| 51久久夜色精品国产麻豆| 亚洲在线中文字幕| 色综合天天综合网国产成人综合天| 久久久久久久综合日本| 国内精品国产成人| 亚洲精品一区二区三区福利| 久久精品国产久精国产| 日韩欧美国产麻豆| 久久成人久久爱| 久久久综合精品| 不卡的av电影在线观看| 最新中文字幕一区二区三区| 99久久er热在这里只有精品66| 亚洲精品一二三四区| 欧美日韩你懂得| 久久av老司机精品网站导航| 久久亚洲春色中文字幕久久久| 国产剧情一区在线| 亚洲免费观看在线视频| 一本大道av伊人久久综合| 亚洲激情在线播放| 欧美日韩大陆一区二区| 久久99国产乱子伦精品免费| 国产亚洲短视频| 91福利在线导航| 麻豆91免费看| 国产片一区二区三区| 色综合天天综合网天天看片| 亚洲人一二三区| 欧美日韩激情一区二区| 国产成人免费视频网站 | 亚洲成人动漫av| www国产成人免费观看视频 深夜成人网| 激情深爱一区二区| 国产精品美女久久久久高潮| 在线观看免费成人| 国产一区二区三区在线观看免费视频| 国产精品天干天干在线综合| 在线精品国精品国产尤物884a| 九色综合狠狠综合久久| 一区二区三区日韩精品视频| 久久久久久久综合| 26uuu亚洲| 欧美美女网站色| 日本伦理一区二区| 99热99精品| 国产98色在线|日韩| 日韩精品一二区| 一区二区三区中文字幕| 中文字幕的久久| 国产亚洲欧美一区在线观看| 91精品国产入口| 制服丝袜亚洲网站| 欧美日韩国产高清一区二区 | 亚洲色图欧洲色图婷婷| 日本一区二区三区免费乱视频| 正在播放一区二区| 9191精品国产综合久久久久久| 欧美无砖专区一中文字| 欧美日韩成人高清| 久久久久九九视频| 亚洲国产欧美在线| 精品一二三四区| 日韩不卡在线观看日韩不卡视频| 久久不见久久见中文字幕免费| 免费看欧美女人艹b| 国产精品资源在线| 99国产精品一区| 欧美色图天堂网| 久久综合九色综合97婷婷女人| 国产亚洲制服色| 亚洲国产精品久久久久婷婷884| 亚洲国产wwwccc36天堂| 另类小说欧美激情| 色噜噜狠狠一区二区三区果冻| 日韩美女视频一区二区在线观看| 欧美精品九九99久久| 亚洲国产精品99久久久久久久久| 亚洲国产wwwccc36天堂| caoporen国产精品视频| 4hu四虎永久在线影院成人| 久久久国产精品午夜一区ai换脸| 亚洲欧洲国产日韩| 久久电影国产免费久久电影| 色哦色哦哦色天天综合| 国产精品丝袜久久久久久app| 一区二区三区四区蜜桃| 高清不卡在线观看av| 日韩一区二区在线看| 一区二区三区成人| 国产精品一区专区| 日韩欧美一级在线播放| 午夜视黄欧洲亚洲| 91麻豆自制传媒国产之光| 国产精品久久久久久久久图文区| 亚洲成a人片在线观看中文| 色呦呦国产精品| 亚洲精品一卡二卡| 国产suv精品一区二区三区| 日韩欧美第一区| 日韩电影在线观看电影| 欧美精品久久久久久久多人混战| 亚洲人妖av一区二区| 国内精品视频一区二区三区八戒 | 91久久精品一区二区二区| 中文字幕一区二区三区在线播放| 国产在线乱码一区二区三区| 91精品福利在线一区二区三区 | 中文字幕一区二区三区在线不卡 | 日产精品久久久久久久性色| 欧美理论在线播放| 国产精品正在播放| 亚洲精品成人精品456| 91精品一区二区三区久久久久久 | 欧美成人性福生活免费看| 国产二区国产一区在线观看| 国产精品久久久久久久久快鸭| 欧美日韩一区二区三区高清| 久久99久久久欧美国产| 亚洲色图都市小说| 亚洲v精品v日韩v欧美v专区| 国产+成+人+亚洲欧洲自线| 欧美精品一区二区三区很污很色的 | 欧美三级在线视频| 久久se这里有精品| 久久亚洲欧美国产精品乐播| 国产成人亚洲精品青草天美| 国产午夜精品久久久久久免费视 | 国产精品欧美综合在线| 色综合天天在线| 麻豆国产精品777777在线| 最新国产の精品合集bt伙计| 69堂成人精品免费视频| 成人h动漫精品| 一区二区三区欧美在线观看| 久久久不卡网国产精品二区| 一本久道久久综合中文字幕| 激情丁香综合五月| 一区二区三区四区乱视频| 久久久青草青青国产亚洲免观| 91久久精品日日躁夜夜躁欧美| 久久超碰97中文字幕| 亚洲三级小视频| 久久久影视传媒| 日韩欧美激情在线| 欧美日韩精品福利| 欧美三级资源在线| 色综合久久精品| 91在线精品秘密一区二区| 蜜桃精品视频在线| 蜜臀久久99精品久久久久宅男| 天堂在线一区二区| 亚洲欧美一区二区三区国产精品| 精品1区2区在线观看| 国产精品美女www爽爽爽| www成人在线观看| 久久美女高清视频| 久久久久久97三级| 精品国产免费一区二区三区四区 | 不卡av免费在线观看| 国产91露脸合集magnet| 国产福利精品导航| 99久久99久久久精品齐齐| av不卡在线观看|