float _DifferenceCost(IMatrix m1, IMatrix m2) { return(m1.AsIndexable().Rows .Zip(m2.AsIndexable().Rows, (r1, r2) => _costFunction.Compute(r1, r2)) .Average() ); }
/// <summary> /// Calculates the error of the output against the target /// </summary> /// <param name="errorMetric">The error metric to calculate with</param> /// <returns></returns> public float CalculateError(IErrorMetric errorMetric) => Output.Zip(Target, (o, t) => errorMetric.Compute(o, t)).Average();