/* -------------------------------------------------------------------------- */ /* */ /* W E I G H T E D A P R I O R I T */ /* */ /* Frans Coenen */ /* */ /* Tuesday 9 September 2008 */ /* */ /* Department of Computer Science */ /* The University of Liverpool */ /* */ /* -------------------------------------------------------------------------- */ /** Class that contains methods to support Weighted Association Rule Mining (WARM) based in the Apriori-T algorithm. */ /* Structure: AssocRuleMining | +-- TotalSupportTree | +-- FuzzyAprioriT | +-- WeightedAprioriT */ //package lucsKDD_ARM; // Java packages import java.io.*; import java.util.*; // Java GUI packages import javax.swing.*; public class WeightedAprioriT extends FuzzyAprioriT { /*------------------------------------------------------------------------*/ /* */ /* FIELDS */ /* */ /*------------------------------------------------------------------------*/ /** 2-D aray to hold input data from data file.

First index is row (record or TID) number starting from 0, and second is attribute (column) number starting from zero. */ protected short[][] dataArray = null; /** Weightings array. */ private double[] weightings = null; /** Number of weighting values, */ private int numWeightings = 0; /*---------------------------------------------------------------------*/ /* */ /* CONSTRUCTORS */ /* */ /*---------------------------------------------------------------------*/ /** With argument from existing instance of class AssocRuleMining. @param newInstance the given instance of the AssocRuleMining class. */ public WeightedAprioriT(FWARMaprioriT newInstance) { super(newInstance); weightings = newInstance.weightings; numWeightings = newInstance.numWeightings; // Create data item int dataLength = newInstance.dataArray.length; dataArray = new short[dataLength][]; // copy for (int index1=0;index1JTextArea class. */ public void createTotalSupportTree(JTextArea textArea) { // Calculate support in terms of number of records double tempSup = numRows*support; textArea.append("Weighted Apriori-T with X-Checking\nMinimum support " + "threshold = " + twoDecPlaces(support) + " (" + twoDecPlaces(tempSup) + " records)\n"); // If no data (possibly as a result of an order and pruning operation) // return if (numOneItemSets==0) return; // Initilise T-tree data structure and diagnostic counters. Set number // of t-tree nodes to zero (this is a static field so will not be reset // in repeat calls to the T-tree constructor). startTtreeRef = null; numFrequentSets = 0; numUpdates = 0l; TtreeNode.setNumberOfNodesFieldToZero(); // Continue: create Ttree top level, generate level 2, and then create // T-tree level Ns (method contained in TotalSupportTree) class. contCreateTtree(textArea); } /** Adds supports to level 1 (top) of the T-tree. */ protected void createTtreeTopLevel2() { //System.out.println("Weighted Apriori-T: createTtreeTopLevel2: numRows = " + //numRows); numLevelsInTtree = 1; // Loop through data set record by record and add support for each // 1 itemset for (int index1=0;index1