diff --git a/src/Numerics/Statistics/ArrayStatistics.cs b/src/Numerics/Statistics/ArrayStatistics.cs index 4fd0b26e..5b883953 100644 --- a/src/Numerics/Statistics/ArrayStatistics.cs +++ b/src/Numerics/Statistics/ArrayStatistics.cs @@ -499,7 +499,7 @@ namespace MathNet.Numerics.Statistics /// /// Estimates the tau-th quantile from the unsorted data array. /// The tau-th quantile is the data value where the cumulative distribution - /// function crosses tau. The quantile definition can be specificed to be compatible + /// function crosses tau. The quantile definition can be specified to be compatible /// with an existing system. /// WARNING: Works inplace and can thus causes the data array to be reordered. /// @@ -706,7 +706,7 @@ namespace MathNet.Numerics.Statistics /// /// Evaluates the rank of each entry of the unsorted data array. - /// The rank definition can be specificed to be compatible + /// The rank definition can be specified to be compatible /// with an existing system. /// WARNING: Works inplace and can thus causes the data array to be reordered. /// diff --git a/src/Numerics/Statistics/SortedArrayStatistics.cs b/src/Numerics/Statistics/SortedArrayStatistics.cs index c29b17e2..a0639d97 100644 --- a/src/Numerics/Statistics/SortedArrayStatistics.cs +++ b/src/Numerics/Statistics/SortedArrayStatistics.cs @@ -235,7 +235,7 @@ namespace MathNet.Numerics.Statistics /// /// Estimates the tau-th quantile from the sorted data array (ascending). /// The tau-th quantile is the data value where the cumulative distribution - /// function crosses tau. The quantile definition can be specificed to be compatible + /// function crosses tau. The quantile definition can be specified to be compatible /// with an existing system. /// /// Sample array, must be sorted ascendingly. @@ -338,7 +338,7 @@ namespace MathNet.Numerics.Statistics } /// - /// Estimates the empirical cummulative distribution function (CDF) at x from the sorted data array (ascending). + /// Estimates the empirical cumulative distribution function (CDF) at x from the sorted data array (ascending). /// /// The data sample sequence. /// The value where to estimate the CDF at. @@ -371,7 +371,7 @@ namespace MathNet.Numerics.Statistics /// /// Estimates the quantile tau from the sorted data array (ascending). /// The tau-th quantile is the data value where the cumulative distribution - /// function crosses tau. The quantile definition can be specificed to be compatible + /// function crosses tau. The quantile definition can be specified to be compatible /// with an existing system. /// /// The data sample sequence. @@ -444,7 +444,7 @@ namespace MathNet.Numerics.Statistics /// /// Evaluates the rank of each entry of the sorted data array (ascending). - /// The rank definition can be specificed to be compatible + /// The rank definition can be specified to be compatible /// with an existing system. /// public static double[] Ranks(double[] data, RankDefinition definition = RankDefinition.Default) diff --git a/src/Numerics/Statistics/Statistics.cs b/src/Numerics/Statistics/Statistics.cs index ee2a1393..945ad582 100644 --- a/src/Numerics/Statistics/Statistics.cs +++ b/src/Numerics/Statistics/Statistics.cs @@ -502,7 +502,7 @@ namespace MathNet.Numerics.Statistics /// /// Estimates the tau-th quantile from the provided samples. /// The tau-th quantile is the data value where the cumulative distribution - /// function crosses tau. The quantile definition can be specificed to be compatible + /// function crosses tau. The quantile definition can be specified to be compatible /// with an existing system. /// /// The data sample sequence. @@ -517,7 +517,7 @@ namespace MathNet.Numerics.Statistics /// /// Estimates the tau-th quantile from the provided samples. /// The tau-th quantile is the data value where the cumulative distribution - /// function crosses tau. The quantile definition can be specificed to be compatible + /// function crosses tau. The quantile definition can be specified to be compatible /// with an existing system. /// /// The data sample sequence. @@ -532,7 +532,7 @@ namespace MathNet.Numerics.Statistics /// /// Estimates the tau-th quantile from the provided samples. /// The tau-th quantile is the data value where the cumulative distribution - /// function crosses tau. The quantile definition can be specificed to be compatible + /// function crosses tau. The quantile definition can be specified to be compatible /// with an existing system. /// /// The data sample sequence. @@ -547,7 +547,7 @@ namespace MathNet.Numerics.Statistics /// /// Estimates the tau-th quantile from the provided samples. /// The tau-th quantile is the data value where the cumulative distribution - /// function crosses tau. The quantile definition can be specificed to be compatible + /// function crosses tau. The quantile definition can be specified to be compatible /// with an existing system. /// /// The data sample sequence. @@ -723,7 +723,7 @@ namespace MathNet.Numerics.Statistics /// /// Evaluates the rank of each entry of the provided samples. - /// The rank definition can be specificed to be compatible + /// The rank definition can be specified to be compatible /// with an existing system. /// /// The data sample sequence. @@ -736,7 +736,7 @@ namespace MathNet.Numerics.Statistics /// /// Evaluates the rank of each entry of the provided samples. - /// The rank definition can be specificed to be compatible + /// The rank definition can be specified to be compatible /// with an existing system. /// /// The data sample sequence. @@ -749,7 +749,7 @@ namespace MathNet.Numerics.Statistics /// /// Estimates the quantile tau from the provided samples. /// The tau-th quantile is the data value where the cumulative distribution - /// function crosses tau. The quantile definition can be specificed to be compatible + /// function crosses tau. The quantile definition can be specified to be compatible /// with an existing system. /// /// The data sample sequence. @@ -765,7 +765,7 @@ namespace MathNet.Numerics.Statistics /// /// Estimates the quantile tau from the provided samples. /// The tau-th quantile is the data value where the cumulative distribution - /// function crosses tau. The quantile definition can be specificed to be compatible + /// function crosses tau. The quantile definition can be specified to be compatible /// with an existing system. /// /// The data sample sequence. @@ -779,7 +779,7 @@ namespace MathNet.Numerics.Statistics /// /// Estimates the quantile tau from the provided samples. /// The tau-th quantile is the data value where the cumulative distribution - /// function crosses tau. The quantile definition can be specificed to be compatible + /// function crosses tau. The quantile definition can be specified to be compatible /// with an existing system. /// /// The data sample sequence. @@ -794,7 +794,7 @@ namespace MathNet.Numerics.Statistics /// /// Estimates the quantile tau from the provided samples. /// The tau-th quantile is the data value where the cumulative distribution - /// function crosses tau. The quantile definition can be specificed to be compatible + /// function crosses tau. The quantile definition can be specified to be compatible /// with an existing system. /// /// The data sample sequence. @@ -805,7 +805,7 @@ namespace MathNet.Numerics.Statistics } /// - /// Estimates the empirical cummulative distribution function (CDF) at x from the provided samples. + /// Estimates the empirical cumulative distribution function (CDF) at x from the provided samples. /// /// The data sample sequence. /// The value where to estimate the CDF at. @@ -817,7 +817,7 @@ namespace MathNet.Numerics.Statistics } /// - /// Estimates the empirical cummulative distribution function (CDF) at x from the provided samples. + /// Estimates the empirical cumulative distribution function (CDF) at x from the provided samples. /// /// The data sample sequence. /// The value where to estimate the CDF at. @@ -827,7 +827,7 @@ namespace MathNet.Numerics.Statistics } /// - /// Estimates the empirical cummulative distribution function (CDF) at x from the provided samples. + /// Estimates the empirical cumulative distribution function (CDF) at x from the provided samples. /// /// The data sample sequence. public static Func EmpiricalCDFFunc(this IEnumerable data) @@ -838,7 +838,7 @@ namespace MathNet.Numerics.Statistics } /// - /// Estimates the empirical cummulative distribution function (CDF) at x from the provided samples. + /// Estimates the empirical cumulative distribution function (CDF) at x from the provided samples. /// /// The data sample sequence. public static Func EmpiricalCDFFunc(this IEnumerable data) @@ -886,5 +886,26 @@ namespace MathNet.Numerics.Statistics { return EmpiricalInvCDFFunc(data.Where(d => d.HasValue).Select(d => d.Value)); } + + /// + /// Calculates the entropy of a stream of double values in bits. + /// Returns NaN if any of the values in the stream are NaN. + /// + /// The data sample sequence. + public static double Entropy(IEnumerable data) + { + return StreamingStatistics.Entropy(data); + } + + /// + /// Calculates the entropy of a stream of double values in bits. + /// Returns NaN if any of the values in the stream are NaN. + /// Null-entries are ignored. + /// + /// The data sample sequence. + public static double Entropy(IEnumerable data) + { + return StreamingStatistics.Entropy(data.Where(d => d.HasValue).Select(d => d.Value)); + } } }