Added CostFunction object and NNModel trait