Class NBTreeNoSplit

    • Constructor Detail

      • NBTreeNoSplit

        public NBTreeNoSplit()
    • Method Detail

      • getErrors

        public double getErrors()
        Return the errors made by the naive bayes model at this node
        Returns:
        the number of errors made
      • getDiscretizer

        public Discretize getDiscretizer()
        Return the discretizer used at this node
        Returns:
        a Discretize value
      • getNaiveBayesModel

        public NaiveBayesUpdateable getNaiveBayesModel()
        Get the naive bayes model at this node
        Returns:
        a NaiveBayesUpdateable value
      • sourceExpression

        public final String sourceExpression​(int index,
                                             Instances data)
        Returns a string containing java source code equivalent to the test made at this node. The instance being tested is called "i".
        Specified by:
        sourceExpression in class ClassifierSplitModel
        Parameters:
        index - index of the nominal value tested
        data - the data containing instance structure info
        Returns:
        a value of type 'String'
      • classProb

        public double classProb​(int classIndex,
                                Instance instance,
                                int theSubset)
                         throws Exception
        Return the probability for a class value
        Overrides:
        classProb in class ClassifierSplitModel
        Parameters:
        classIndex - the index of the class value
        instance - the instance to generate a probability for
        theSubset - the subset to consider
        Returns:
        a probability
        Throws:
        Exception - if an error occurs
      • toString

        public String toString()
        Return a textual description of the node
        Overrides:
        toString in class Object
        Returns:
        a String value
      • crossValidate

        public static double crossValidate​(NaiveBayesUpdateable fullModel,
                                           Instances trainingSet,
                                           Random r)
                                    throws Exception
        Utility method for fast 5-fold cross validation of a naive bayes model
        Parameters:
        fullModel - a NaiveBayesUpdateable value
        trainingSet - an Instances value
        r - a Random value
        Returns:
        a double value
        Throws:
        Exception - if an error occurs
      • getRevision

        public String getRevision()
        Returns the revision string.
        Returns:
        the revision