rdr.core
Class SimulatedExpert

java.lang.Object
  extended by rdr.core.SimulatedExpert

public class SimulatedExpert
extends java.lang.Object

SimulatedExpert This class pretends to be a human expert. It selects conditions from a machine learned knowledge base (using a Weka machine learner, in this case Ridor(Explainer)).

Author:
Ivan Bindoff

Field Summary
 BinaryRelevanceClassifier brClassifier
           
 
Constructor Summary
SimulatedExpert(java.lang.String experimentName, java.lang.String datasetName, weka.core.Instances data, BinaryRelevanceClassifier brClassifier, double specificity, int numCases, int numClassifications, boolean buildFlag)
          Constructor.
 
Method Summary
 void buildException(Node parent, common.datastructures.MyFastVector<Condition> availableConditions, Case currentCase)
          Select a portion of the availableConditions to make an exception rule to parent which is satisfied by currentCase
 Rule buildRule(common.datastructures.MyFastVector<Condition> conditions)
          Attempt to use some of the conditions to create a rule.
 void buildRule(Node parent, common.datastructures.MyFastVector<Condition> availableConditions, Case currentCase, Classification conc)
           
 void compareOutcomes(Case currentCase, weka.core.Instance currentInstance, common.datastructures.MyFastVector<Node> results, common.datastructures.MyFastVector<java.lang.String> predictedClasses, java.lang.String[] labelNames)
          Compares the rdrResults with the predicted outcomes from the machine learned knowledge base.
 Classifier getClassifier()
          Returns the classifier.
 common.datastructures.MyFastVector<Condition> getConditionsFromRidor(common.datastructures.MyFastVector<weka.classifiers.rules.RidorExplainer.RidorRule> ridorRules, common.datastructures.MyFastVector<Condition> existing)
          Builds up a vector of Conditions using a vector of RidorRules.
 common.datastructures.MyFastVector<Condition> getRuleTraceFromRidor(common.datastructures.MyFastVector<weka.classifiers.rules.RidorExplainer.RidorRule> ridorRules, common.datastructures.MyFastVector<weka.classifiers.rules.RidorExplainer.Antd> negRules)
          Builds up a vector of Conditions using a vector of RidorRules.
 Classifier trainKnowledgeBase()
          Tells this simulated expert to start training the knowledge base
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

brClassifier

public BinaryRelevanceClassifier brClassifier
Constructor Detail

SimulatedExpert

public SimulatedExpert(java.lang.String experimentName,
                       java.lang.String datasetName,
                       weka.core.Instances data,
                       BinaryRelevanceClassifier brClassifier,
                       double specificity,
                       int numCases,
                       int numClassifications,
                       boolean buildFlag)
Constructor. Creates an instance of a simulated expert, using a particular weka classifier. This simulated expert produces an MCRDR knowledge base by default. If you want to make other types of knowledge bases, extend this class and write your own trainKnowledgeBase, selectConditions, and buildNode methods.

Method Detail

trainKnowledgeBase

public Classifier trainKnowledgeBase()
Tells this simulated expert to start training the knowledge base


compareOutcomes

public void compareOutcomes(Case currentCase,
                            weka.core.Instance currentInstance,
                            common.datastructures.MyFastVector<Node> results,
                            common.datastructures.MyFastVector<java.lang.String> predictedClasses,
                            java.lang.String[] labelNames)
Compares the rdrResults with the predicted outcomes from the machine learned knowledge base. If there's discrepancies in the two sets of outcomes, create rules to amend these.

Parameters:
rdrResults -
predictedClasses -
labelNames -

buildException

public void buildException(Node parent,
                           common.datastructures.MyFastVector<Condition> availableConditions,
                           Case currentCase)
Select a portion of the availableConditions to make an exception rule to parent which is satisfied by currentCase

Parameters:
parent -
availableConditions -
currentCase -

buildRule

public void buildRule(Node parent,
                      common.datastructures.MyFastVector<Condition> availableConditions,
                      Case currentCase,
                      Classification conc)

getConditionsFromRidor

public common.datastructures.MyFastVector<Condition> getConditionsFromRidor(common.datastructures.MyFastVector<weka.classifiers.rules.RidorExplainer.RidorRule> ridorRules,
                                                                            common.datastructures.MyFastVector<Condition> existing)
Builds up a vector of Conditions using a vector of RidorRules. Same as GetRuleTrace only it ignores negRules.

Parameters:
ridorRules -
Returns:
MyFastVector

getRuleTraceFromRidor

public common.datastructures.MyFastVector<Condition> getRuleTraceFromRidor(common.datastructures.MyFastVector<weka.classifiers.rules.RidorExplainer.RidorRule> ridorRules,
                                                                           common.datastructures.MyFastVector<weka.classifiers.rules.RidorExplainer.Antd> negRules)
Builds up a vector of Conditions using a vector of RidorRules.

Parameters:
ridorRules -
Returns:
MyFastVector

buildRule

public Rule buildRule(common.datastructures.MyFastVector<Condition> conditions)
Attempt to use some of the conditions to create a rule.

Parameters:
conditions -
Returns:
Rule

getClassifier

public Classifier getClassifier()
Returns the classifier.

Returns:
the classifier that has been trained so far.