Say I have:
class DecisionTree(private val instances: Array[Instance]){
and I want to calculate another instance variable, say totalEntropy, that requires me to do some further processing that will require instantiating a hashmap as part of the calculations.
I’ve come up with:
private var totalEntropy = (() => {
val m = collection.mutable.Map()
...
})()
but this seems awkward. Should I just forgo the arguments in the class definition altogether and use an auxiliary constructor? What is a good way of doing this?
Why not just this?