MAE is the average of the absolute differences between the predicted and actual targets and is given as follows:

MAE is similar in principle to MSE, but it does not punish large deviations as much.
Our function to compute MAE is as follows:
Scala def absError(actual:Double, pred: Double) : Double = { return Math.abs( (pred - actual)) }