de.jstacs.classifier
Class MeasureParameters

java.lang.Object
  extended by de.jstacs.parameters.Parameter
      extended by de.jstacs.parameters.CollectionParameter
          extended by de.jstacs.parameters.MultiSelectionCollectionParameter
              extended by de.jstacs.classifier.MeasureParameters
All Implemented Interfaces:
Rangeable, RangeIterator, Storable, Cloneable

public final class MeasureParameters
extends MultiSelectionCollectionParameter

This class holds the parameters for evaluate-methods of a classifier.

Author:
Jan Grau, Jens Keilwagen
See Also:
AbstractClassifier.evaluate(MeasureParameters, boolean, de.jstacs.data.Sample...), AbstractClassifier.evaluateAll(MeasureParameters, boolean, de.jstacs.data.Sample...)

Nested Class Summary
static class MeasureParameters.Measure
          This Enum defines all measures that are currently implemented in Jstacs.
 
Nested classes/interfaces inherited from class de.jstacs.parameters.CollectionParameter
CollectionParameter.InconsistentCollectionException
 
Field Summary
 
Fields inherited from class de.jstacs.parameters.CollectionParameter
errorMessage, parameters, userSelected
 
Fields inherited from class de.jstacs.parameters.Parameter
neededReference, neededReferenceId, parent
 
Constructor Summary
MeasureParameters(boolean evaluateAll)
          This constructor creates a new empty instance of MeasureParameters.
MeasureParameters(boolean evaluateAll, double sp, double snForFPR, double snForPPV)
          This constructor creates a new instance of MeasureParameters.
MeasureParameters(boolean evaluateAll, double sp, double snForFPR, double snForPPV, double minSpec, double maxSpec, int steps, RangeParameter.Scale scale)
           
MeasureParameters(StringBuffer representation)
          Re-creates a MeasureParameters instance from its XML-representation as returned by MultiSelectionCollectionParameter.toXML().
 
Method Summary
 void deselectAll()
          De-selects all measures, i.e. calls setSelected(Measure, false)} for all MeasureParameters.Measures.
 LinkedList<Result> getAnnotation()
          Returns the selected parameters and their values as a list of results.
 boolean isSelected(MeasureParameters.Measure sel)
          Returns true if the option sel is selected.
 void setSelected(MeasureParameters.Measure sel, boolean b)
          Selects or de-selects the option sel depending on b.
 
Methods inherited from class de.jstacs.parameters.MultiSelectionCollectionParameter
checkValue, clone, fromXML, getNumberOfNexts, getNumberOfValues, getSelected, getValue, getValueFor, getValueFor, getValues, hasDefaultOrIsSet, isAtomic, isRanged, isSelected, isSelected, isSet, next, reset, resetToFirst, setDefault, setSelected, setSelected, setValue, simplify, toXML, valuesToString
 
Methods inherited from class de.jstacs.parameters.CollectionParameter
appendCollection, createParameterSet, equals, extractCollection, getComment, getDatatype, getDefault, getErrorMessage, getName, getParametersInCollection, getRangedInstance, hasDefault, isRangeable, isRequired, isUserSelected, setRangeable
 
Methods inherited from class de.jstacs.parameters.Parameter
getId, getNeededReference, getNeededReferenceId, getParent, setNeededReference, setParent
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MeasureParameters

public MeasureParameters(boolean evaluateAll)
                  throws ParameterException
This constructor creates a new empty instance of MeasureParameters.

Parameters:
evaluateAll - if true the instance contains the parameters for the evaluateAll-method, otherwise it only contains the parameters for the evaluate-method
Throws:
ParameterException

MeasureParameters

public MeasureParameters(boolean evaluateAll,
                         double sp,
                         double snForFPR,
                         double snForPPV)
                  throws ParameterException
This constructor creates a new instance of MeasureParameters. All measure are switched on and the parameters of specificity and sensitivity are set to the given values.

Parameters:
evaluateAll - if true the instance contains the parameters for the evaluateAll-method, otherwise it only contains the parameters for the evaluate-method
sp - the (fixed) specificity
snForFPR - the (fixed) sensitivity for the FPR
snForPPV - the (fixed) sensitivity for the PPV
Throws:
ParameterException

MeasureParameters

public MeasureParameters(boolean evaluateAll,
                         double sp,
                         double snForFPR,
                         double snForPPV,
                         double minSpec,
                         double maxSpec,
                         int steps,
                         RangeParameter.Scale scale)
                  throws ParameterException
Parameters:
evaluateAll - if true the instance contains the parameters for the evaluateAll-method, otherwise it only contains the parameters for the evaluate-method
sp - the (fixed) specificity
snForFPR - the (fixed) sensitivity for the FPR
snForPPV - the (fixed) sensitivity for the PPV
minSpec - the minimal specificity
maxSpec - the maximal specificity
steps - the number of steps
scale - see RangerParameter
Throws:
ParameterException
See Also:
RangeParameter.Scale

MeasureParameters

public MeasureParameters(StringBuffer representation)
                  throws NonParsableException
Re-creates a MeasureParameters instance from its XML-representation as returned by MultiSelectionCollectionParameter.toXML().

Parameters:
representation - the XML-representation
Throws:
NonParsableException - is thrown if the XML-code could not be parsed
Method Detail

setSelected

public void setSelected(MeasureParameters.Measure sel,
                        boolean b)
Selects or de-selects the option sel depending on b.

Parameters:
sel - the option
b - the new selection

isSelected

public boolean isSelected(MeasureParameters.Measure sel)
Returns true if the option sel is selected.

Parameters:
sel - the option
Returns:
if the option sel is selected

deselectAll

public void deselectAll()
De-selects all measures, i.e. calls setSelected(Measure, false)} for all MeasureParameters.Measures.


getAnnotation

public LinkedList<Result> getAnnotation()
Returns the selected parameters and their values as a list of results.

Returns:
a list of all selected parameters and their values