org.apache.spark.mllib.tree.impurity
Interface Impurity

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
Entropy, Gini, Variance

public interface Impurity
extends scala.Serializable

:: Experimental :: Trait for calculating information gain. This trait is used for (a) setting the impurity parameter in Strategy (b) calculating impurity values from sufficient statistics.


Method Summary
 double calculate(double[] counts, double totalCount)
          :: DeveloperApi :: information calculation for multiclass classification
 double calculate(double count, double sum, double sumSquares)
          :: DeveloperApi :: information calculation for regression
 

Method Detail

calculate

double calculate(double[] counts,
                 double totalCount)
:: DeveloperApi :: information calculation for multiclass classification

Parameters:
counts - Array[Double] with counts for each label
totalCount - sum of counts for all labels
Returns:
information value, or 0 if totalCount = 0

calculate

double calculate(double count,
                 double sum,
                 double sumSquares)
:: DeveloperApi :: information calculation for regression

Parameters:
count - number of instances
sum - sum of labels
sumSquares - summation of squares of the labels
Returns:
information value, or 0 if count = 0