Class ClassifierWithFeatureImportance

  • All Implemented Interfaces:
    Configurable, Serializable, CapabilitiesHandler, Classifier, MultiClassClassifier, AWTRenderable, Learner<Example<Instance>>, MOAObject, OptionHandler

    public class ClassifierWithFeatureImportance
    extends AbstractClassifier
    implements MultiClassClassifier
    Classifier with Feature Importance

    This meta algorithm serves the purpose of executing a classifier also capable of outputting feature importances. Classifiers implementing the moa.streams.FeatureImportance interface

    Hyperparameters:

    • -l : Learner implementing FeatureImportance interface.
    • -n : Whether to normalize or not the feature importances.
    • -w : How often to verify and output
    • -o : Maximum number of features to include in the output file.
    • -c : Debug file
    • -d : Whether to output the results to the debug file or not. Useful to analyze the
    Version:
    $Revision: 1 $
    Author:
    Heitor Murilo Gomes (heitor dot gomes at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • featureImportanceLearnerOption

        public ClassOption featureImportanceLearnerOption
      • doNotNormalizeFeatureScoreOption

        public FlagOption doNotNormalizeFeatureScoreOption
      • windowSizeOption

        public IntOption windowSizeOption
      • maxFeaturesDebugOption

        public IntOption maxFeaturesDebugOption
      • debugFileOption

        public FileOption debugFileOption
      • doNotOutputResultsToFileOption

        public FlagOption doNotOutputResultsToFileOption
      • instancesSeen

        protected long instancesSeen
      • mean

        protected double mean
      • median

        protected double median
      • max

        protected double max
      • min

        protected double min
      • sum

        protected double sum
    • Constructor Detail

      • ClassifierWithFeatureImportance

        public ClassifierWithFeatureImportance()
    • Method Detail

      • createDebugOutputFile

        protected void createDebugOutputFile()
      • resetLearningImpl

        public void resetLearningImpl()
        Description copied from class: AbstractClassifier
        Resets this classifier. It must be similar to starting a new classifier from scratch.

        The reason for ...Impl methods: ease programmer burden by not requiring them to remember calls to super in overridden methods. Note that this will produce compiler errors if not overridden.
        Specified by:
        resetLearningImpl in class AbstractClassifier
      • trainOnInstanceImpl

        public void trainOnInstanceImpl​(Instance instance)
        Description copied from class: AbstractClassifier
        Trains this classifier incrementally using the given instance.

        The reason for ...Impl methods: ease programmer burden by not requiring them to remember calls to super in overridden methods. Note that this will produce compiler errors if not overridden.
        Specified by:
        trainOnInstanceImpl in class AbstractClassifier
        Parameters:
        instance - the instance to be used for training
      • getCurrentFeatureImportances

        public double[] getCurrentFeatureImportances()
      • getVotesForInstance

        public double[] getVotesForInstance​(Instance instance)
        Description copied from interface: Classifier
        Predicts the class memberships for a given instance. If an instance is unclassified, the returned array elements must be all zero.
        Specified by:
        getVotesForInstance in interface Classifier
        Specified by:
        getVotesForInstance in class AbstractClassifier
        Parameters:
        instance - the instance to be classified
        Returns:
        an array containing the estimated membership probabilities of the test instance in each class
      • isRandomizable

        public boolean isRandomizable()
        Description copied from interface: Learner
        Gets whether this learner needs a random seed. Examples of methods that needs a random seed are bagging and boosting.
        Specified by:
        isRandomizable in interface Learner<Example<Instance>>
        Returns:
        true if the learner needs a random seed.
      • getModelDescription

        public void getModelDescription​(StringBuilder arg0,
                                        int arg1)
        Description copied from class: AbstractClassifier
        Returns a string representation of the model.
        Specified by:
        getModelDescription in class AbstractClassifier
        Parameters:
        arg0 - the stringbuilder to add the description
        arg1 - the number of characters to indent
      • getModelMeasurementsImpl

        protected Measurement[] getModelMeasurementsImpl()
        Description copied from class: AbstractClassifier
        Gets the current measurements of this classifier.

        The reason for ...Impl methods: ease programmer burden by not requiring them to remember calls to super in overridden methods. Note that this will produce compiler errors if not overridden.
        Specified by:
        getModelMeasurementsImpl in class AbstractClassifier
        Returns:
        an array of measurements to be used in evaluation tasks
      • describe

        protected String describe()
        Describe the feature importance method used. This is added to the first line of the output file.
        Returns:
        description of the model used