rdr.methods
Class MCRDR

java.lang.Object
  extended by rdr.core.Classifier
      extended by rdr.methods.MCRDR
All Implemented Interfaces:
java.io.Serializable

public class MCRDR
extends Classifier
implements java.io.Serializable

An implementation of the Multiple Classification Ripple Down Rules method. Uses NTreeNode. Based on specification by Kang.

Author:
Ivan Bindoff
See Also:
Serialized Form

Field Summary
 NTreeNode root
           
 common.datastructures.MyFastVector<Case> seenCases
           
 
Fields inherited from class rdr.core.Classifier
highestID, nodeIndex
 
Constructor Summary
MCRDR()
           
 
Method Summary
 void buildCornerstones(NTreeNode newNode)
          Checks the parent node's cornerstones to see if they're also cornerstones for this node Should only be called when the node is first added, otherwise use insertCornerstone to update as appropriate
 common.datastructures.MyFastVector<Node> classify(Case c)
          The default classify method.
 common.datastructures.MyFastVector<Node> classify(Case c, NTreeNode n)
          Perform an MCRDR inference to classify the case c
 java.lang.String getClassName()
           
 common.datastructures.MyFastVector<Case> getCornerstones(Rule newRule, NTreeNode parent)
          Fetch the cornerstone cases that would apply to a newRule being added as a child of parent
 NTreeNode getNode(int nodeID)
          Find a node based on a node ID
 NTreeNode getRoot()
           
 boolean insertNode(Case theCase, Node newNode, Node parentNode)
           
 void launchKAGUI(int mode, Case c)
          Launch the knowledge acquisition GUi which is designed for this classification method
 void launchKAGUI(int mode, Case c, int nodeEditing)
           
 boolean load()
           
 boolean save()
           
 boolean save(java.lang.String modelName)
          Saves the classifier including knowledge base to file - serialized.
 void updateSeenCases(Case c)
          Inserts the case c into the seen cases set only if it's not already in there.
 
Methods inherited from class rdr.core.Classifier
getNodeIndex, incrementID
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

seenCases

public common.datastructures.MyFastVector<Case> seenCases

root

public NTreeNode root
Constructor Detail

MCRDR

public MCRDR()
Method Detail

classify

public common.datastructures.MyFastVector<Node> classify(Case c)
The default classify method. Classifies case c from the root node.

Specified by:
classify in class Classifier
Parameters:
c - the case to classify

classify

public common.datastructures.MyFastVector<Node> classify(Case c,
                                                         NTreeNode n)
Perform an MCRDR inference to classify the case c

Parameters:
c - the case to classify
n - the node we're currently evaluating
Returns:
set of nodes which the case satisfies

load

public boolean load()
Specified by:
load in class Classifier

save

public boolean save()
Specified by:
save in class Classifier

save

public boolean save(java.lang.String modelName)
Saves the classifier including knowledge base to file - serialized.

Returns:
true if the file saves correctly

insertNode

public boolean insertNode(Case theCase,
                          Node newNode,
                          Node parentNode)
Specified by:
insertNode in class Classifier

launchKAGUI

public void launchKAGUI(int mode,
                        Case c,
                        int nodeEditing)
Specified by:
launchKAGUI in class Classifier

launchKAGUI

public void launchKAGUI(int mode,
                        Case c)
Launch the knowledge acquisition GUi which is designed for this classification method

Specified by:
launchKAGUI in class Classifier
Parameters:
mode - the mode code (i.e. ADD, EDIT, REMOVE)
c - the case that the rule is being created for

getNode

public NTreeNode getNode(int nodeID)
Find a node based on a node ID

Parameters:
nodeID - the node id
Returns:
the node

updateSeenCases

public void updateSeenCases(Case c)
Inserts the case c into the seen cases set only if it's not already in there.

Parameters:
c -

getClassName

public java.lang.String getClassName()
Specified by:
getClassName in class Classifier
Returns:
the name of this class as a string

getCornerstones

public common.datastructures.MyFastVector<Case> getCornerstones(Rule newRule,
                                                                NTreeNode parent)
Fetch the cornerstone cases that would apply to a newRule being added as a child of parent

Parameters:
newRule - the new rule
parent - the parent node
Returns:
set of cornerstone cases

buildCornerstones

public void buildCornerstones(NTreeNode newNode)
Checks the parent node's cornerstones to see if they're also cornerstones for this node Should only be called when the node is first added, otherwise use insertCornerstone to update as appropriate

Parameters:
newNode - the new node that needs to have its cornerstone cases built

getRoot

public NTreeNode getRoot()
Returns:
a reference to the root node