Class PriorProbabilityClassifier

  • All Implemented Interfaces:
    Algorithm, Classifier<java.lang.Object>

    @Title("Prior Probability Classifier")
    @Description("Classifier to predict simply prior probabilities for all classes as defined by their relative abundance in a given database.")
    public class PriorProbabilityClassifier
    extends AbstractClassifier<java.lang.Object,​java.lang.Void>
    Classifier to classify instances based on the prior probability of classes in the database, without using the actual data values.
    Since:
    0.7.0
    Author:
    Arthur Zimek
    • Field Detail

      • distribution

        protected double[] distribution
        Holds the prior probabilities.
      • prediction

        protected ClassLabel prediction
        Index of the most abundant class.
      • labels

        protected java.util.ArrayList<ClassLabel> labels
        Class labels seen.
    • Constructor Detail

      • PriorProbabilityClassifier

        public PriorProbabilityClassifier()
        Constructor.
    • Method Detail

      • buildClassifier

        public void buildClassifier​(Database database,
                                    Relation<? extends ClassLabel> labelrep)
        Learns the prior probability for all classes.
        Parameters:
        database - the database to build the model on
        labelrep - the classes to be learned
      • classProbabilities

        public double[] classProbabilities​(java.lang.Object instance,
                                           java.util.ArrayList<ClassLabel> labels)
      • classify

        public ClassLabel classify​(java.lang.Object instance)
        Description copied from interface: Classifier
        Classify a single instance.
        Parameters:
        instance - an instance to classify
        Returns:
        predicted class label of the given instance
      • model

        public java.lang.String model()
        Description copied from interface: Classifier
        Produce a String representation of the classification model.
        Returns:
        a String representation of the classification model
      • getInputTypeRestriction

        public TypeInformation[] getInputTypeRestriction()
        Description copied from interface: Algorithm
        Get the input type restriction used for negotiating the data query.
        Returns:
        Type restriction