I have the following normalization function:
...
private def NormalizeValues(dataValues: Array [Double]): Array[Double] = {
val min = dataValues.min
val max = dataValues.max
dataValues.map(v => (v - min) / (max - min))
}
...
And I want it to work whether it receives an Array of Double or an Array of Int. Better than just turning the Array of Int to Array of Double, I guess there must be a better way to do this maybe using a more generic type or specifying that Array[Doubles]
and Array[Int]
can be received indistinctly, in the function definition.
Do you have any idea?