BotSharp/BotSharp.Algorithm/HiddenMarkovModel/MathUtils/Statistics/CollectionExtensionMethods.cs

19 lines
492 B
C#
Raw Normal View History

2018-09-17 12:31:54 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BotSharp.Algorithm.HiddenMarkovModel.MathUtils.Statistics
{
public static class CollectionExtensionMethods
{
public static double? Average(this IEnumerable<double> values, int precision_point)
{
int count = values.Count();
if (count == 0) return null;
return System.Math.Round(values.Average(), precision_point);
}
}
}