neural netwok cost fcn and its tests