jcolibri.method.revise.classification
Class BasicClassificationOracle

java.lang.Object
  extended by jcolibri.method.revise.classification.BasicClassificationOracle
All Implemented Interfaces:
ClassificationOracle

public class BasicClassificationOracle
extends java.lang.Object
implements ClassificationOracle

This class represents a decision-maker to decide if a query has been correctly classified or not and to assign a cost to incorrectly classified queries.

Author:
Derek Bridge, Lisa Cummins 16/05/07

Constructor Summary
BasicClassificationOracle()
           
 
Method Summary
 double getPredictionCost(CBRQuery query, CBRCaseBase caseBase, KNNClassificationConfig knnConfig)
          Calculates the cost of the prediction made by the given case-base and similarity configuration for the solution of the query.
 double getPredictionCost(ClassificationSolution predictedSolution, CBRCase testCase)
          Calculates the cost of the given solution as a prediction for the solution of the given case.
 double getPredictionCost(ClassificationSolution predictedSolution, ClassificationSolution correctSolution)
          Calculates the cost of the given test solution while bein compared to the given correct solution.
 boolean isCorrectPrediction(CBRQuery query, CBRCaseBase caseBase, KNNClassificationConfig knnConfig)
          Checks if the query is correctly classified by the given case-base and similarity configuration.
 boolean isCorrectPrediction(ClassificationSolution predictedSolution, CBRCase testCase)
          Checks if the predicted solution is the correct solution for the given test case.
 boolean isCorrectPrediction(ClassificationSolution predictedSolution, ClassificationSolution correctSolution)
          Checks if the predicted solution and the correct solution are the same.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicClassificationOracle

public BasicClassificationOracle()
Method Detail

isCorrectPrediction

public boolean isCorrectPrediction(ClassificationSolution predictedSolution,
                                   CBRCase testCase)
Checks if the predicted solution is the correct solution for the given test case.

Specified by:
isCorrectPrediction in interface ClassificationOracle
Parameters:
predictedSolution - the predicted solution.
testCase - the test case (query and correct solution).
Returns:
true if the predicted solution is the correct solution for the given test case, false if not.

isCorrectPrediction

public boolean isCorrectPrediction(ClassificationSolution predictedSolution,
                                   ClassificationSolution correctSolution)
Checks if the predicted solution and the correct solution are the same.

Specified by:
isCorrectPrediction in interface ClassificationOracle
Parameters:
predictedSolution - the predicted solution.
correctSolution - the correct solution.
Returns:
true if the predicted solution and the correct solution are the same, false if not.

isCorrectPrediction

public boolean isCorrectPrediction(CBRQuery query,
                                   CBRCaseBase caseBase,
                                   KNNClassificationConfig knnConfig)
Checks if the query is correctly classified by the given case-base and similarity configuration.

Specified by:
isCorrectPrediction in interface ClassificationOracle
Parameters:
query - the query to be tested.
caseBase - the case base to use to find the predicted solution.
knnConfig - the similarity configuration.
Returns:
true if the query is correctly classified by the given case-base and similarity configuration, fasle otherwise.

getPredictionCost

public double getPredictionCost(ClassificationSolution predictedSolution,
                                CBRCase testCase)
Calculates the cost of the given solution as a prediction for the solution of the given case. The cost returned is 0 for a correct prediction and 1 for a wrong prediction.

Specified by:
getPredictionCost in interface ClassificationOracle
Parameters:
predictedSolution - the predicted solution.
testCase - the test case (query and correct solution).
Returns:
the cost of the prediction made (0 if the prediction is correct, 1 otherwise).

getPredictionCost

public double getPredictionCost(ClassificationSolution predictedSolution,
                                ClassificationSolution correctSolution)
Calculates the cost of the given test solution while bein compared to the given correct solution. The cost returned is 0 for a correct prediction and 1 for a wrong prediction.

Specified by:
getPredictionCost in interface ClassificationOracle
Parameters:
predictedSolution - the predicted solution.
correctSolution - the correct solution.
Returns:
Returns the cost of the prediction made (0 if the prediction is correct, 1 otherwise).

getPredictionCost

public double getPredictionCost(CBRQuery query,
                                CBRCaseBase caseBase,
                                KNNClassificationConfig knnConfig)
Calculates the cost of the prediction made by the given case-base and similarity configuration for the solution of the query. The cost returned is 0 for a correct prediction and 1 for a wrong prediction.

Specified by:
getPredictionCost in interface ClassificationOracle
Parameters:
query - the query to be tested.
caseBase - the case base to use to find the predicted solution.
knnConfig - the similarity configuration.
Returns:
the cost of the prediction made (0 if the prediction is correct, 1 otherwise).

GAIA - Group for Artificial Intelligence Applications
http://gaia.fdi.ucm.es