public class ImpurityScore extends Object implements Cloneable
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 and Description |
---|
ImpurityScore(int classCount,
ImpurityScore.ImpurityMeasure impurityMeasure)
Creates a new impurity score that can be updated
|
Modifier and Type | Method and Description |
---|---|
void |
addPoint(DataPoint dp,
int targetClass)
Adds one more point to the impurity score
|
void |
addPoint(double weight,
int targetClass)
Adds one more point to the impurity score
|
protected ImpurityScore |
clone() |
static double |
gain(ImpurityScore wholeData,
double wholeScale,
ImpurityScore... splits)
Computes the gain in score from a splitting of the data set
|
static double |
gain(ImpurityScore wholeData,
ImpurityScore... splits)
Computes the gain in score from a splitting of the data set
|
ImpurityScore.ImpurityMeasure |
getImpurityMeasure()
Returns the impurity measure being used
|
CategoricalResults |
getResults()
Obtains the current categorical results by prior probability
|
double |
getScore()
Computes the current impurity score for the points that have been added.
|
double |
getSumOfWeights()
Returns the sum of the weights for all points currently in the impurity
score
|
void |
removePoint(DataPoint dp,
int targetClass)
Removes one point from the impurity score
|
void |
removePoint(double weight,
int targetClass)
Removes one point from the impurity score
|
public ImpurityScore(int classCount, ImpurityScore.ImpurityMeasure impurityMeasure)
classCount
- the number of target class valuesimpurityMeasure
- public void removePoint(DataPoint dp, int targetClass)
dp
- the data point to addtargetClass
- the class of the point to addpublic void removePoint(double weight, int targetClass)
weight
- the weight of the point to addtargetClass
- the class of the point to addpublic void addPoint(DataPoint dp, int targetClass)
dp
- the data point to addtargetClass
- the class of the point to addpublic void addPoint(double weight, int targetClass)
weight
- the weight of the point to addtargetClass
- the class of the point to addpublic double getScore()
public double getSumOfWeights()
public ImpurityScore.ImpurityMeasure getImpurityMeasure()
public CategoricalResults getResults()
public static double gain(ImpurityScore wholeData, ImpurityScore... splits)
wholeData
- the score for the whole data setsplits
- the scores for each of the splitspublic static double gain(ImpurityScore wholeData, double wholeScale, ImpurityScore... splits)
wholeData
- the score for the whole data setwholeScale
- a constant to scale the wholeData counts and sums by, useful for handling missing value casessplits
- the scores for each of the splitsprotected ImpurityScore clone()
Copyright © 2017. All rights reserved.