/// <summary> /// Возращает среднюю метрику metric по всему DataEnumerator /// </summary> /// <param name="data"></param> /// <param name="metric"></param> /// <returns></returns> public virtual double GetMeanMetric(IDataEnumerator data, IMetric metric) { data.Reset(); double mean_metric = 0; int count = 0; object lock_target = new object(); Parallel.ForEach(data, (needed) => { double[,,] output = GetOutput(needed.input); var m = metric.Metric(output, needed.output); lock (lock_target) { mean_metric += m; count++; } }); data.Reset(); mean_metric /= count; return(mean_metric); }