`Impurity` should be renamed to `Error` or something more technical and familiar. Also see the comments earlier for the necessity and example design of a generic `Error` interface.
   
The `calculate` method can be renamed to something verbose like `error`.
   
For a generic interface, an additional `ErrorStats` trait and `error(errorStats: ErrorStats)` method can be added. For example, `Variance` or more aptly, `SquareError`, would implement `case class SquareErrorStats(count: Long, mean: Double, meanSquare: Double)` and `error(errorStats) = errorStats.meanSquare - errorStats.mean * errorStats.mean / count`. Note that `ErrorStats` should have aggregation methods, e.g., it's easy to see the implementation for `SquareErrorStats`.

The `Variance` class should be renamed to `SquareError`, `Entropy` to `EntropyError` or `KLDivergence`, `Gini` to `GiniError`.