public class CrTree extends PruneCAR implements java.io.Serializable
| Constructor and Description |
|---|
CrTree()
Constructor constructs an empty CrTree
|
CrTree(CrNode root,
weka.core.Instances instances,
weka.core.Instances onlyClass)
Constructor
|
CrTree(weka.core.Instances instances,
weka.core.Instances onlyClass)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
deleteContent(CrNode node,
int index)
Deletes one rule out of the CrTree
|
void |
deleteNode(CrNode node)
deletes a node out of the CrTree if possible
|
CrList |
getAssociateList()
Gets the associated list
|
int |
getDefaultClass()
Gets the default class
|
java.lang.String[] |
getOptions()
Gets the current settings of the CrTree object.
|
CrNode |
getRoot()
Gets the root node
|
void |
insertContent(CrNode node,
weka.core.FastVector input)
Adds another consequence to an existing premise.
|
void |
insertNode(weka.core.FastVector rulePremise,
weka.core.FastVector ruleConsequence)
insert a new rule into the CrTree in three steps: 1.
|
boolean |
isEmpty()
Checks if the the CrTree is empty
|
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options.
|
void |
makeEmpty()
Deletes the whole CrTree and its associated list by setting the child
pointer of the root to null
|
java.lang.String |
pathToString(java.lang.String metricString)
Prints a rule
|
void |
preprocess(java.util.ArrayList<java.lang.Object> premises,
java.util.ArrayList<java.lang.Object> consequences,
java.util.ArrayList<java.lang.Object> confidences)
The preprocessing step before a rule is inserted into a CrTree.
|
void |
prune()
Method for pruning a CrTree.
|
void |
pruneBeforeInsertion(weka.core.FastVector premise,
weka.core.FastVector consequence)
Method that provides a pruning step before a rule is inserted into the
CrTree.
|
int |
prunedRules()
Returns the number of pruned rules
|
weka.core.FastVector |
pruningCriterions(weka.core.FastVector input)
Potentially adds additional measures that can be used as pruning criterias
to a rule.
|
void |
removeAtChild(CrNode node,
CrNode sibling)
Deletes a node out of the parent list.
|
void |
removeAtList(CrNode node)
deletes the node out of the list that connects nodes storing the same item.
|
void |
removeAtSibling(CrNode node)
Deletes a node out of the child list.
|
int[] |
reportSubtreeCount(CrNode subTreeRoot)
Gets the class distribution of the rules from a subtree of a specified node
|
java.lang.String |
rulePremise()
Prints a rule premise (from bottom to top in the tree, respectively
infrequent items to frequent ones).
|
weka.core.FastVector |
search(weka.core.FastVector data)
Searches for an existing rule premise are parts of an rule premise in the
CrTree
|
void |
setDefaultClass()
Sets the default class as the amjority class in the instances.
|
void |
setInstancesNoClass(weka.core.Instances instances)
Sets the instances (without class attribute)
|
void |
setInstancesOnlyClass(weka.core.Instances instances)
Sets the class information
|
void |
setOptions(java.lang.String[] options)
Parses a given list of options.
|
weka.core.FastVector |
sortItemSet(weka.associations.ItemSet current)
Sorts an item set accoring to the frequencies values of the items.
|
java.lang.String |
toString(java.lang.String metricString)
Returns a string description of the CrTree Object
|
void |
updateHeight(CrNode node)
Adjust the (minimum) height of a CrListElement
|
public CrTree()
public CrTree(CrNode root, weka.core.Instances instances, weka.core.Instances onlyClass)
root - the root nodeinstances - the instances without class attributeonlyClass - the class attribute and its values for all instancespublic CrTree(weka.core.Instances instances,
weka.core.Instances onlyClass)
instances - the instances without class attributeonlyClass - the class attribute and its values for all instancespublic final void setInstancesNoClass(weka.core.Instances instances)
setInstancesNoClass in class PruneCARinstances - instances without classattributepublic final void setInstancesOnlyClass(weka.core.Instances instances)
setInstancesOnlyClass in class PruneCARinstances - the class attribute and its valuespublic void preprocess(java.util.ArrayList<java.lang.Object> premises,
java.util.ArrayList<java.lang.Object> consequences,
java.util.ArrayList<java.lang.Object> confidences)
throws java.lang.Exception
preprocess in class PruneCARpremises - the premisesconsequences - the consequencesconfidences - the interestingness measuresjava.lang.Exception - throws exception if preprocessing is not possiblepublic void setDefaultClass()
public int getDefaultClass()
public final weka.core.FastVector sortItemSet(weka.associations.ItemSet current)
current - the item setpublic weka.core.FastVector pruningCriterions(weka.core.FastVector input)
pruningCriterions in class PruneCARinput - pruning criteriapublic void pruneBeforeInsertion(weka.core.FastVector premise,
weka.core.FastVector consequence)
pruneBeforeInsertion in class PruneCARpremise - the rule premiseconsequence - the rule consequencepublic final boolean isEmpty()
public final CrNode getRoot()
public final CrList getAssociateList()
public final void removeAtSibling(CrNode node)
node - the node that has to be deletet out of the child listpublic final void removeAtChild(CrNode node, CrNode sibling)
node - the node that has to be deletedsibling - a sibling nodepublic final void removeAtList(CrNode node)
node - the node that has to be deletedpublic final void updateHeight(CrNode node)
node - the node that has to deletedpublic final void deleteContent(CrNode node, int index)
deleteContent in class PruneCARnode - the node where the consequence of the rule is storedindex - the index of the consequencepublic final void deleteNode(CrNode node)
node - the node that should be deletedpublic void insertContent(CrNode node, weka.core.FastVector input)
insertContent in class PruneCARnode - the node where the conesequence should be addedinput - the consequencepublic final void insertNode(weka.core.FastVector rulePremise,
weka.core.FastVector ruleConsequence)
rulePremise - the rule premiseruleConsequence - the consequence and additional measurespublic final weka.core.FastVector search(weka.core.FastVector data)
data - the rule premisepublic void prune()
public final void makeEmpty()
public int[] reportSubtreeCount(CrNode subTreeRoot)
subTreeRoot - the root of the subtreepublic java.lang.String rulePremise()
public java.lang.String toString(java.lang.String metricString)
public java.lang.String pathToString(java.lang.String metricString)
metricString - the metric used for class association rule miningpublic java.lang.String[] getOptions()
getOptions in interface weka.core.OptionHandlerpublic java.util.Enumeration listOptions()
listOptions in interface weka.core.OptionHandlerpublic void setOptions(java.lang.String[] options)
throws java.lang.Exception
There are no options available.
setOptions in interface weka.core.OptionHandleroptions - the list of options as an array of stringsjava.lang.Exception - if an option is not supportedpublic int prunedRules()
prunedRules in class PruneCAR