|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.udo.cs.yale.operator.Operator
edu.udo.cs.yale.operator.performance.PerformanceEvaluator
public class PerformanceEvaluator
A performance evaluator is an operator that expects a test ExampleSet
as input, whose elements have both true and predicted labels, and delivers as
output a list of performance values according to a list of performance
criteria that it calculates. If an input performance vector was already
given, this is used for keeping the performance values.
All of the performance criteria can be switched on using boolean parameters.
Their values can be queried by a
ExperimentLogOperator
using the same names.
The main criterion is used for comparisons and need to be specified only for
experiments where performance vectors are compared, e.g. feature selection
experiments. If no other main criterion was selected the first criterion in the
resulting performance vector will be assumed to be the main criterion.
Additional user-defined implementations of PerformanceCriterion
can be specified by using the parameter list
additional_performance_criteria. Each key/value pair in this list
must specify a fully qualified classname (as the key), and a string
parameter (as value) that is passed to the constructor. Please make sure
that the class files are in the classpath (this is the case if the
implementations are supplied by a plugin) and that they implement a
one-argument constructor taking a string parameter. It must also be ensured
that these classes extend MeasuredPerformance
since the PerformanceEvaluator
operator will only support these criteria. Please note that only the
first three user defined criteria can be used as logging value with names
"user1", ... , "user3".
The resulting performance vectors are usually compared with a standard
performance comparator which only compares the fitness values of the main
criterion. Other implementations than this simple comparator can be
specified using the parameter comparator_class. This may for
instance be useful if you want to compare performance vectors according to
the weighted sum of the individual criteria. In order to implement your own
comparator, simply subclass PerformanceComparator
. Please note that
for true multi-objective optimization usually another selection scheme is
used instead of simply replacing the performance comparator.
Field Summary | |
---|---|
private static java.lang.String[] |
allCriteriaDescriptions
|
private static java.lang.String[] |
allCriteriaNames
|
private static java.util.Map<java.lang.String,java.lang.Class> |
classnameMap
Maps criteria names to classes. |
private static java.lang.Class[] |
CRITERIA_CLASSES
The proper criteria to the names. |
private static java.lang.String[] |
CRITERIA_NAMES
Names of the performance criteria which can be used in experiment configuration files. |
private PerformanceVector |
currentPerformanceVector
The currently used performance vector. |
private static int |
NUMBER_OF_USER_CRITERIA
The number of allowed user criteria. |
private java.util.ArrayList<PerformanceCriterion> |
userCriteria
This list is needed for logging purposes of user defined criteria. |
Constructor Summary | |
---|---|
PerformanceEvaluator(OperatorDescription description)
|
Method Summary | |
---|---|
private void |
addPerformanceValue(java.lang.String name,
java.lang.String description)
Adds the performance criteria as plottable values, e.g. for the ExperimentLog operator. |
IOObject[] |
apply()
Implement this method in subclasses. |
private boolean |
checkCriterionName(java.lang.String name)
Returns true if the criterion with the given name should be added to the performance vector. |
protected PerformanceVector |
evaluate(ExampleSet testSet,
PerformanceVector inputPerformance)
Evaluates the given test set. |
static void |
evaluate(PerformanceEvaluator evaluator,
ExampleSet testSet,
PerformanceVector performanceCriteria,
java.util.List<PerformanceCriterion> givenCriteria,
boolean skipUndefinedLabels)
Static version of evaluate(ExampleSet,PerformanceVector) . |
java.lang.Class[] |
getInputClasses()
Returns the classes that are needed as input. |
InputDescription |
getInputDescription(java.lang.Class cls)
Shows a parameter keep_example_set with default value "false". |
java.lang.Class[] |
getOutputClasses()
Returns the classes that are guaranteed to be returned by apply() as additional output. |
java.util.List<ParameterType> |
getParameterTypes()
Returns a list of ParameterTypes describing the parameters of this operator. |
private PerformanceVector |
initialisePerformanceVector(ExampleSet testSet,
PerformanceVector performanceCriteria,
java.util.List<PerformanceCriterion> givenCriteria)
Creates a new performance vector if the given one is null. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final int NUMBER_OF_USER_CRITERIA
private static final java.lang.String[] CRITERIA_NAMES
private static final java.lang.Class[] CRITERIA_CLASSES
private static java.lang.String[] allCriteriaNames
private static java.lang.String[] allCriteriaDescriptions
private static java.util.Map<java.lang.String,java.lang.Class> classnameMap
private java.util.ArrayList<PerformanceCriterion> userCriteria
private PerformanceVector currentPerformanceVector
Constructor Detail |
---|
public PerformanceEvaluator(OperatorDescription description)
Method Detail |
---|
private void addPerformanceValue(java.lang.String name, java.lang.String description)
private PerformanceVector initialisePerformanceVector(ExampleSet testSet, PerformanceVector performanceCriteria, java.util.List<PerformanceCriterion> givenCriteria) throws OperatorException
OperatorException
private boolean checkCriterionName(java.lang.String name) throws UndefinedParameterError
UndefinedParameterError
public IOObject[] apply() throws OperatorException
Operator
apply
in class Operator
OperatorException
protected PerformanceVector evaluate(ExampleSet testSet, PerformanceVector inputPerformance) throws OperatorException
PerformanceCriterion
instances
in the given PerformanceVector
must be subclasses of
MeasuredPerformance
.
OperatorException
public static void evaluate(PerformanceEvaluator evaluator, ExampleSet testSet, PerformanceVector performanceCriteria, java.util.List<PerformanceCriterion> givenCriteria, boolean skipUndefinedLabels) throws OperatorException
evaluate(ExampleSet,PerformanceVector)
. This
method was introduced to enable testing of the method.
evaluator
- Ususally this. May be null for testing. Only needed for
exception.
OperatorException
public InputDescription getInputDescription(java.lang.Class cls)
getInputDescription
in class Operator
public java.lang.Class[] getInputClasses()
Operator
Operator.getOutputClasses()
and
Operator.apply()
if this is necessary. This default behavior can be
changed by overriding Operator.getInputDescription(Class)
. Subclasses
which implement this method should not make use of parameters since this
method is invoked by getParameterTypes(). Therefore, parameters are not
fully available at this point of time and this might lead to exceptions.
Please use InputDescriptions instead.
getInputClasses
in class Operator
public java.lang.Class[] getOutputClasses()
Operator
Operator.getInputDescription(Class)
and can be changed by
overwriting this method. Objects which are not consumed must not be
defined as additional output in this method. May be null or an empy array
(no additional output is produced).
getOutputClasses
in class Operator
public java.util.List<ParameterType> getParameterTypes()
Operator
getParameterTypes
in class Operator
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |