public class TotalSupportTree extends AssocRuleMining
javax.swing.JFrame.AccessibleJFrame
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
Modifier and Type | Field and Description |
---|---|
protected RuleList |
currentRlist
Instance of the class RuleList
|
protected java.lang.String |
duration
Time to generate P-tree.
|
protected int |
MAX_NUM_FREQUENT_SETS
The maximum number of frequent sets that may be generated.
|
protected boolean |
nextLevelExists
The next level indicator flag: set to true if new level
generated and by default.
|
protected int |
numFrequentsets
The number of frequent sets (nodes in t-tree with above minimum
support) generated so far.
|
protected long |
numUpdates
The number of updates required to generate the T-tree.
|
protected TtreeNode[] |
startTtreeRef
The reference to start of t-tree.
|
confidence, conversionArray, dataArray, errorFlag, fileInput, fileName, filePath, inputFormatOkFlag, minSupport, numClasses, numCols, numOneItemSets, numRows, reconversionArray, support
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Constructor and Description |
---|
TotalSupportTree(double minConf,
double minSup,
int delta)
Processes command line arguments.
|
Modifier and Type | Method and Description |
---|---|
protected int |
calculateStorage()
Commences process of calculating storage requirements for T-tree.
|
protected int |
countNumFreqSets()
Commences process of counting the number of frequent (large/supported)
sets conayoned in the T-tree.
|
protected int |
countNumFreqSets(int size,
TtreeNode[] linkRef,
int num)
Counts the number of supported nodes in a sub branch of the T-tree.
|
protected void |
createTtreeTopLevel()
Generates level 1 (top) of the T-tree.
|
protected void |
createTtreeTopLevel2()
Adds supports to level 1 (top) of the T-tree.
|
protected boolean |
findItemSetInTtree(short[] itemSet)
Commences process of determining if an itemset exists in a T-tree.
|
protected void |
generateLevel2()
Generates level 2 of the T-tree.
|
protected void |
generateLevelN(TtreeNode[] linkRef,
int level,
short[] itemSet)
Commences process of generating remaining levels in the T-tree (other
than top and 2nd levels).
|
protected void |
generateNextLevel(TtreeNode[] parentRef,
int endIndex,
short[] itemSet)
Generates a new level in the T-tree from a given "parent" node.
|
protected double |
getConfidence(double antecedentSupp,
double totalSupp)
Calculates and returns the conidence for an AR given the support for
both the antecedent and the entire item set.
|
protected double |
getConfidence(short[] antecedent,
double support)
Calculates and returns the conidence for an AR given the antecedent
item set and the support for the total item set.
|
RuleList |
getCurrentRuleListObject()
Gets the current instance of the RuleList class.
|
double |
getMinSupport()
Returns the minimum support threshold value in terms of a number
records.
|
int |
getNumFreqSets()
Returns number of frequent/large (supported) sets in T-tree.
|
protected int |
getSupportForItemSetInTtree(short[] itemSet)
Commences process for finding the support value for the given item set
in the T-tree.
|
void |
outputFrequentSets()
Commences the process of outputting the frequent sets contained in
the T-tree.
|
void |
outputFrequentSets(javax.swing.JTextArea textArea)
Commences the process of outputting the frequent sets contained in
the T-tree to a rext area.
|
void |
outputNumFreqSets()
Commences the process of counting and outputing number of supported
nodes in the T-tree.
|
void |
outputNumFreqSetsPerBranch()
Outputs the number of supported sets per T-tree branch descending from
the top-level of the tree.
|
void |
outputNumUpdates()
Outputs the number of update and number of nodes created during the
generation of the T-tree (the later is not the same as the number of
supported nodes).
|
void |
outputStorage()
Commences the process of determining and outputting the storage
requirements (in bytes) for the T-tree.
|
void |
outputTtree()
Commences process of outputting T-tree structure contents to screen.
|
void |
outputTtreeBranch(TtreeNode[] linkRef)
Commences process of outputting contents of a given T-tree branch to
screen.
|
void |
outputTtreeStats()
Commences the process of outputting T-tree statistics (for diagnostic
purposes): (a) Storage, (b) Number of nodes on P-tree, (c) number of
partial support increments (updates) and (d) generation time.
|
void |
outputTtreeStats(javax.swing.JTextArea textArea)
Commences the process of outputting T-tree statistics:GUI version.
|
protected boolean |
pruneLevelN(TtreeNode[] linkRef,
int level)
Prunes the given level in the T-tree.
|
void |
setNumOneItemSets()
Sets the number of one item sets field (numOneItemSets to
the number of supported one item sets.
|
protected boolean |
testCombinations(short[] currentItemSet)
Commences the process of testing whether the N-1 sized sub-sets of a
newly created T-tree node are supported elsewhere in the Ttree --- (a
process refered to as "X-Checking").
|
append, binConversion, checkForLeadingSubString, checkItemSets, combinations, complement, copyItemSet, copyItemSet, countSingles, defConvertArrays, getConfidence, getDuration, getLastElement, getNumSupOneItemSets, idInputDataOrdering, inputDataSet, isBefore, isEqual, isSubset, notMemberOf, orderFirstNofCountArray, outputConversionArrays, outputDataArray, outputDataArray, outputDataArraySize, outputDuration, outputItemSet, outputItemSetWithReconversion, outputMenu, outputSettings, outputSettings2, outputSuppAndConf, readFile, realloc1, realloc2, realloc3, realloc4, reallocInsert, recastInputData, recastInputDataAndPruneUnsupportedAtts, removeFirstNelements, resizeInputData, similar2dec, sortItemSet, threeDecPlaces, twoDecPlaces
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
protected TtreeNode[] startTtreeRef
protected final int MAX_NUM_FREQUENT_SETS
protected boolean nextLevelExists
protected RuleList currentRlist
protected int numFrequentsets
protected long numUpdates
protected java.lang.String duration
public TotalSupportTree(double minConf, double minSup, int delta)
minConf
- double Minimum confidence thresholdminSup
- double Minimum support thresholddelta
- int Minimum coverage thresholdprotected void createTtreeTopLevel()
protected void createTtreeTopLevel2()
protected boolean pruneLevelN(TtreeNode[] linkRef, int level)
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 minSupport field.
linkRef
- The reference to the current sub-branch of T-tree (start at
top of tree)level
- the level marker, set to the required level at the start and
then decremented by 1 on each recursion.protected void generateLevel2()
The general generateLevelN 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 generateLevelN(TtreeNode[] linkRef, int level, short[] itemSet)
Proceeds in a recursive manner level by level untill the required level is reached. Example, if we have a T-tree of the form:
(A) ----- (B) ----- (C) | | | | (A) (A) ----- (B)
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.
linkRef
- the reference to the current sub-branch of T-tree (start at
top of tree).level
- the level marker, set to the required level at the start and
then decremented by 1 on each recursion.itemSet
- the current itemset under consideration.protected void generateNextLevel(TtreeNode[] parentRef, int endIndex, short[] itemSet)
Example 1, given the following:
(A) ----- (B) ----- (C) | | | | (A) (A) ----- (B)
where we wish to add a level 3 node to node (B), i.e. the node {A}, we would proceed as follows:
Example 2, given:
(A) ----- (D) | | (A) ----- (B) ----- (C) | | (A) ----- (B)
where we wish to add a level 4 node (A) to (B) this would represent the complete label {D,C,B,A}, the N-1 subsets will then be {{D,C,B},{D,C,A}, {D,B,A} and {C,B,A}}. We know the first two are supported becuase they are contained in the current sub-branch of the T-tree, {D,B,A} and {C,B,A} are not.
parentRef
- the reference to the level in the sub-branch of the T-tree
under consideration.endIndex
- the index of the current node under consideration.itemSet
- the complete label represented by the current node (required
to generate further itemsets to be X-checked).protected boolean testCombinations(short[] currentItemSet)
Thus given a candidate large itemsets whose size-1 subsets are contained (supported) in the current branch of the T-tree, tests whether size-1 subsets contained in other branches are supported. Proceed as follows:
itemSet1 = first two items in current item set
itemSet2 = remainder of items in current item set
Example 1:
currentItemSet = {A,B,C} itemSet1 = {B,A} (change of ordering) size = {A,B,C}-2 = 1 itemSet2 = {C} (currentItemSet with first two elements removed) calculate combinations between {B,A} and {C}
Example 2:
currentItemSet = {A,B,C,D} itemSet1 = {B,A} (change of ordering) itemSet2 = {C,D} (currentItemSet with first two elements removed) calculate combinations between {B,A} and {C,D}
currentItemSet
- the given itemset.protected boolean findItemSetInTtree(short[] itemSet)
Used to X-check existance of Ttree nodes when generating new levels of the Tree. Note that T-tree node labels are stored in "reverse", e.g. {3,2,1}.
itemSet
- the given itemset (IN REVERSE ORDER).protected int getSupportForItemSetInTtree(short[] itemSet)
Used when generating Associoation Rules (ARs). Note that itemsets are stored in reverse order in the T-tree therefore the given itemset must be processed in reverse.
itemSet
- the given itemset.protected double getConfidence(short[] antecedent, double support)
antecedent
- the antecedent (LHS) of the AR.support
- the support for the large itemset from which the AR is
generated.protected double getConfidence(double antecedentSupp, double totalSupp)
antecedentSupp
- the support for antecedent (LHS) of the AR.totalSupp
- the support for the large itemset from which the AR is
generated.public int getNumFreqSets()
public double getMinSupport()
public RuleList getCurrentRuleListObject()
public void setNumOneItemSets()
public void outputTtree()
public void outputTtreeBranch(TtreeNode[] linkRef)
linkRef
- the reference to the start of the branchpublic void outputFrequentSets()
public void outputFrequentSets(javax.swing.JTextArea textArea)
textArea
- the text area.public void outputNumFreqSets()
A supported set is assumed to be a non null node in the T-tree.
protected int countNumFreqSets()
protected int countNumFreqSets(int size, TtreeNode[] linkRef, int num)
size
- the length/size of the current array lavel in the T-tree.linkRef
- the reference to the current array lavel in the T-tree.num
- the number of frequent serts sofar.public void outputNumFreqSetsPerBranch()
Used for diagnostic purposes.
public void outputTtreeStats()
public void outputTtreeStats(javax.swing.JTextArea textArea)
textArea
- the text area.public void outputNumUpdates()
public void outputStorage()
Example: Given ---
{1,2,3} {1,2,3} {1,2,3} {1,2,3} {1,2,3}This will produce a T-tree as shown below:
+---+---+---+---+ | 0 | 1 | 2 | 3 | +---+---+---+---+ | | | | | +-----------+ | | | | +---+ +---+---+---+ | | | 0 | 1 | 2 | ( 5 ) +---+---+ +---+---+---+ (nul) | 0 | 1 | | | +---+---+ | +----+ | | | | | +---+---+ ( 5 ) | | 0 + 1 | (nul) ( 5 ) +---+---+ (nul) | | ( 5 ) (nul)0 elements require 4 bytes of storage, null nodes (not shown above) 4 bytes of storage, others 12 bytes of storage.
protected int calculateStorage()