Class PredictionHelper


  • public class PredictionHelper
    extends Object
    Helper class for dealing with predictions from result items.
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    • Constructor Detail

      • PredictionHelper

        public PredictionHelper()
    • Method Detail

      • toSpreadSheet

        public static SpreadSheet toSpreadSheet​(LoggingSupporter logger,
                                                MessageCollection errors,
                                                ResultItem item,
                                                boolean addAdditionalAttributes,
                                                boolean showError)
        Turns the result item into a spreadsheet with the predictions.
        Parameters:
        logger - the object used for logging, can be null
        errors - for collecting errors
        item - the result item to use
        addAdditionalAttributes - whether to add additional attributes
        showError - whether to add the error in a separate column
        Returns:
        the generated spreadsheet
      • toSpreadSheet

        public static SpreadSheet toSpreadSheet​(LoggingSupporter logger,
                                                MessageCollection errors,
                                                weka.classifiers.Evaluation eval,
                                                int[] originalIndices,
                                                SpreadSheet additionalAttributes,
                                                boolean showError)
        Turns the result item into a spreadsheet with the predictions.
        Parameters:
        logger - the object used for logging, can be null
        errors - for collecting errors
        eval - the evaluation to use
        originalIndices - the original indices to use, can be null
        additionalAttributes - the additional attributes to add, can be null
        showError - whether to add the error in a separate column
        Returns:
        the generated spreadsheet
      • toSpreadSheet

        public static SpreadSheet toSpreadSheet​(LoggingSupporter logger,
                                                MessageCollection errors,
                                                ResultItem item,
                                                boolean addAdditionalAttributes,
                                                boolean addLabelIndex,
                                                boolean showDistribution,
                                                boolean showProbability,
                                                boolean showError,
                                                boolean showWeight)
        Turns the result item into a spreadsheet with the predictions.
        Parameters:
        logger - the object used for logging, can be null
        errors - for collecting errors
        item - the result item to use
        addAdditionalAttributes - whether to add additional attributes
        addLabelIndex - whether to add the label index in a separate column
        showDistribution - whether to add the distribution in a separate column
        showProbability - whether to add the probability in a separate column
        showError - whether to add the error in a separate column
        showWeight - whether to add the weight in a separate column
        Returns:
        the generated spreadsheet, null if failed
      • toSpreadSheet

        public static SpreadSheet toSpreadSheet​(LoggingSupporter logger,
                                                MessageCollection errors,
                                                weka.classifiers.Evaluation eval,
                                                int[] originalIndices,
                                                SpreadSheet additionalAttributes,
                                                boolean addLabelIndex,
                                                boolean showDistribution,
                                                boolean showProbability,
                                                boolean showError,
                                                boolean showWeight)
        Turns the result item into a spreadsheet with the predictions.
        Parameters:
        logger - the object used for logging, can be null
        errors - for collecting errors
        eval - the evaluation to use
        originalIndices - the original indices to use, can be null
        additionalAttributes - the additional attributes to use, can be null
        addLabelIndex - whether to add the label index in a separate column
        showDistribution - whether to add the distribution in a separate column
        showProbability - whether to add the probability in a separate column
        showError - whether to add the error in a separate column
        showWeight - whether to add the weight in a separate column
        Returns:
        the generated spreadsheet, null if failed