Documentation of 'jsat.classifiers.trees.ImpurityScore' Java class
ImpurityScore
jsat.classifiers.trees

Class ImpurityScore

  • All Implemented Interfaces:
    java.lang.Cloneable


    public class ImpurityScore
    extends java.lang.Object
    implements java.lang.Cloneable
    ImpurityScore provides a measure of the impurity of a set of data points respective to their class labels. The impurity score is maximized when the classes are evenly distributed, and minimized when all points belong to one class.
    The gain in purity can be computed using the static gain methods of the class. However, not all impurity measures can be used for arbitrary data and splits. Some may only support binary splits, and some may only support binary target classes.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class and Description
      static class  ImpurityScore.ImpurityMeasure
      Different methods of measuring the impurity in a set of data points based on nominal class labels
    • Constructor Detail

      • ImpurityScore

        public ImpurityScore(int classCount,
                             ImpurityScore.ImpurityMeasure impurityMeasure)
        Creates a new impurity score that can be updated
        Parameters:
        classCount - the number of target class values
        impurityMeasure -
    • Method Detail

      • removePoint

        public void removePoint(DataPoint dp,
                                int targetClass)
        Removes one point from the impurity score
        Parameters:
        dp - the data point to add
        targetClass - the class of the point to add
      • removePoint

        public void removePoint(double weight,
                                int targetClass)
        Removes one point from the impurity score
        Parameters:
        weight - the weight of the point to add
        targetClass - the class of the point to add
      • addPoint

        public void addPoint(DataPoint dp,
                             int targetClass)
        Adds one more point to the impurity score
        Parameters:
        dp - the data point to add
        targetClass - the class of the point to add
      • addPoint

        public void addPoint(double weight,
                             int targetClass)
        Adds one more point to the impurity score
        Parameters:
        weight - the weight of the point to add
        targetClass - the class of the point to add
      • getScore

        public double getScore()
        Computes the current impurity score for the points that have been added. A higher score is worse, a score of zero indicates a perfectly pure set of points (all one class).
        Returns:
        the impurity score
      • getSumOfWeights

        public double getSumOfWeights()
        Returns the sum of the weights for all points currently in the impurity score
        Returns:
        the sum of weights
      • getImpurityMeasure

        public ImpurityScore.ImpurityMeasure getImpurityMeasure()
        Returns the impurity measure being used
        Returns:
        the impurity measure being used
      • getResults

        public CategoricalResults getResults()
        Obtains the current categorical results by prior probability
        Returns:
        the categorical results for the current score
      • gain

        public static double gain(ImpurityScore wholeData,
                                  ImpurityScore... splits)
        Computes the gain in score from a splitting of the data set
        Parameters:
        wholeData - the score for the whole data set
        splits - the scores for each of the splits
        Returns:
        the gain for the values given
      • gain

        public static double gain(ImpurityScore wholeData,
                                  double wholeScale,
                                  ImpurityScore... splits)
        Computes the gain in score from a splitting of the data set
        Parameters:
        wholeData - the score for the whole data set
        wholeScale - a constant to scale the wholeData counts and sums by, useful for handling missing value cases
        splits - the scores for each of the splits
        Returns:
        the gain for the values given

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.