Class AbstractInstanceEvaluator

    • Field Detail

      • m_Initialized

        protected boolean m_Initialized
        whether the evaluator got initialized.
    • Constructor Detail

      • AbstractInstanceEvaluator

        public AbstractInstanceEvaluator()
    • Method Detail

      • setUp

        protected String setUp()
        Performs necessary initializations before being able to evaluate.

        Default implementation only returns null.
        Returns:
        null if everything fine, error message otherwise
      • check

        protected String check​(weka.core.Instance inst)
        Peforms checks on the instance that is about to be evaluated.

        Default implementation only checks whether class value is non-missing.
        Parameters:
        inst - the instance to evaluate
        Returns:
        null if Instance can be evaluated, error message otherwise
      • doEvaluate

        protected abstract double doEvaluate​(weka.core.Instance inst)
        Performs the actual evaluation.
        Parameters:
        inst - the instance to evaluate
        Returns:
        evaluation range, between 0 and 1 (0 = bad, 1 = good, -1 = if unable to evaluate)
      • evaluate

        public double evaluate​(weka.core.Instance inst)
        Evaluates the given instance.
        Parameters:
        inst - the instance to evaluate
        Returns:
        evaluation range, between 0 and 1 (0 = bad, 1 = good, -1 = if unable to evaluate)
      • compareTo

        public int compareTo​(Object o)
        Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

        Only compares the commandlines of the two objects.
        Parameters:
        o - the object to be compared.
        Returns:
        a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
        Throws:
        ClassCastException - if the specified object's type prevents it from being compared to this object.
      • equals

        public boolean equals​(Object o)
        Returns whether the two objects are the same.

        Only compares the commandlines of the two objects.
        Overrides:
        equals in class Object
        Parameters:
        o - the object to be compared
        Returns:
        true if the object is the same as this one
      • shallowCopy

        public AbstractInstanceEvaluator shallowCopy()
        Returns a shallow copy of itself, i.e., based on the commandline options.
        Returns:
        the shallow copy
      • shallowCopy

        public AbstractInstanceEvaluator shallowCopy​(boolean expand)
        Returns a shallow copy of itself, i.e., based on the commandline options.
        Parameters:
        expand - whether to expand variables to their current values
        Returns:
        the shallow copy
      • getEvaluators

        public static String[] getEvaluators()
        Returns a list with classnames of evaluators.
        Returns:
        the evaluator classnames
      • forName

        public static AbstractInstanceEvaluator forName​(String classname,
                                                        String[] options)
        Instantiates the evaluator with the given options.
        Parameters:
        classname - the classname of the evaluator to instantiate
        options - the options for the evaluator
        Returns:
        the instantiated evaluator or null if an error occurred
      • forCommandLine

        public static AbstractInstanceEvaluator forCommandLine​(String cmdline)
        Instantiates the evaluator from the given commandline (i.e., classname and optional options).
        Parameters:
        cmdline - the classname (and optional options) of the evaluator to instantiate
        Returns:
        the instantiated evaluator or null if an error occurred
      • cleanUp

        public void cleanUp()
        Cleans up data structures, frees up memory.

        Default implementation does nothing.
        Specified by:
        cleanUp in interface CleanUpHandler