C# Class Accord.Statistics.Measures

Mostrar archivo Open project: accord-net/framework Class Usage Examples

Public Methods

Method Description
GetHistogramRange ( this values, double percent ) : IntRange

Get range around median of an histogram containing specified percentage of values.

The input array is treated as histogram, i.e. its indexes are treated as values of stochastic function, but array values are treated as "probabilities" (total amount of hits).

The method calculates range of stochastic variable, which summary probability comprises the specified percentage of histogram's hits.

HistogramEntropy ( this values ) : double

Calculate entropy value of an histogram.

The input array is treated as histogram, i.e. its indexes are treated as values of stochastic function, but array values are treated as "probabilities" (total amount of hits).

HistogramMax ( this values ) : int

Gets the maximum value in the histogram.

HistogramMean ( this values ) : double

Calculate mean value of an histogram.

The input array is treated as histogram, i.e. its indexes are treated as values of stochastic function, but array values are treated as "probabilities" (total amount of hits).

HistogramMedian ( this values ) : int

Calculate median value of an histogram.

The input array is treated as histogram, i.e. its indexes are treated as values of stochastic function, but array values are treated as "probabilities" (total amount of hits).

The median value is calculated accumulating histogram's values starting from the left point until the sum reaches 50% of histogram's sum.

HistogramMin ( this values ) : int

Gets the minimum value in the histogram.

HistogramMode ( this values ) : int

Calculate mode value of an histogram.

The input array is treated as histogram, i.e. its indexes are treated as values of stochastic function, but array values are treated as "probabilities" (total amount of hits).

Returns the minimum mode value if the specified histogram is multimodal.

HistogramStandardDeviation ( this values ) : double

Calculate standard deviation of an histogram.

The input array is treated as histogram, i.e. its indexes are treated as values of stochastic function, but array values are treated as "probabilities" (total amount of hits).

HistogramStandardDeviation ( this values, double mean ) : double

Calculate standard deviation of an histogram.

The input array is treated as histogram, i.e. its indexes are treated as values of stochastic function, but array values are treated as "probabilities" (total amount of hits).

The method is an equivalent to the HistogramStandardDeviation(int[]) method, but it relies on the passed mean value, which is previously calculated using HistogramMean method.

HistogramSum ( this values ) : long

Calculates the total number of samples in a histogram.

WeightedCovariance ( double matrix, double weights, double means ) : ].double[

Calculates the scatter matrix of a sample matrix.

By dividing the Scatter matrix by the sample size, we get the population Covariance matrix. By dividing by the sample size minus one, we get the sample Covariance matrix.

WeightedCovariance ( double matrix, double weights, double means, int dimension ) : ].double[

Calculates the scatter matrix of a sample matrix.

By dividing the Scatter matrix by the sample size, we get the population Covariance matrix. By dividing by the sample size minus one, we get the sample Covariance matrix.

WeightedCovariance ( double matrix, double weights, int dimension ) : ].double[

Calculates the scatter matrix of a sample matrix.

By dividing the Scatter matrix by the sample size, we get the population Covariance matrix. By dividing by the sample size minus one, we get the sample Covariance matrix.

WeightedCovariance ( double matrix, int weights, double means, int dimension ) : ].double[

Calculates the scatter matrix of a sample matrix.

By dividing the Scatter matrix by the sample size, we get the population Covariance matrix. By dividing by the sample size minus one, we get the sample Covariance matrix.

WeightedCovariance ( double matrix, int weights, int dimension ) : ].double[

Calculates the scatter matrix of a sample matrix.

By dividing the Scatter matrix by the sample size, we get the population Covariance matrix. By dividing by the sample size minus one, we get the sample Covariance matrix.

WeightedMean ( double matrix, double weights, int dimension ) : double[]

Calculates the weighted matrix Mean vector.

WeightedMean ( double matrix, int weights, int dimension ) : double[]

Calculates the weighted matrix Mean vector.

WeightedMean ( this matrix, double weights ) : double[]

Calculates the weighted matrix Mean vector.

WeightedMean ( this matrix, int weights ) : double[]

Calculates the weighted matrix Mean vector.

WeightedScatter ( double matrix, double weights, double means, double factor, int dimension ) : ].double[

Calculates the scatter matrix of a sample matrix.

By dividing the Scatter matrix by the sample size, we get the population Covariance matrix. By dividing by the sample size minus one, we get the sample Covariance matrix.

WeightedScatter ( double matrix, int weights, double means, double factor, int dimension ) : ].double[

Calculates the scatter matrix of a sample matrix.

By dividing the Scatter matrix by the sample size, we get the population Covariance matrix. By dividing by the sample size minus one, we get the sample Covariance matrix.

WeightedStandardDeviation ( this matrix, double weights ) : double[]

Calculates the matrix Standard Deviations vector.

WeightedStandardDeviation ( this matrix, double weights, bool unbiased = true ) : double[]

Calculates the matrix Standard Deviations vector.

Setting unbiased to true will make this method compute the standard deviation σ using the sample variance, which is an unbiased estimator of the true population variance. Setting this parameter to true will thus compute σ using the following formula:

N σ² = 1 / (N - 1) ∑ (x_i − μ)² i=1

Setting unbiased to false will assume the given values already represent the whole population, and will compute the population variance using the formula:

N σ² = (1 / N) ∑ (x_i − μ)² i=1
WeightedStandardDeviation ( this matrix, double weights, double means ) : double[]

Calculates the matrix Standard Deviations vector.

WeightedStandardDeviation ( this matrix, double weights, double means, bool unbiased = true ) : double[]

Calculates the matrix Standard Deviations vector.

Setting unbiased to true will make this method compute the standard deviation σ using the sample variance, which is an unbiased estimator of the true population variance. Setting this parameter to true will thus compute σ using the following formula:

N σ² = 1 / (N - 1) ∑ (x_i − μ)² i=1

Setting unbiased to false will assume the given values already represent the whole population, and will compute the population variance using the formula:

N σ² = (1 / N) ∑ (x_i − μ)² i=1
WeightedStandardDeviation ( this matrix, int weights ) : double[]

Calculates the matrix Standard Deviations vector.

WeightedStandardDeviation ( this matrix, int weights, bool unbiased = true ) : double[]

Calculates the matrix Standard Deviations vector.

Setting unbiased to true will make this method compute the standard deviation σ using the sample variance, which is an unbiased estimator of the true population variance. Setting this parameter to true will thus compute σ using the following formula:

N σ² = 1 / (N - 1) ∑ (x_i − μ)² i=1

Setting unbiased to false will assume the given values already represent the whole population, and will compute the population variance using the formula:

N σ² = (1 / N) ∑ (x_i − μ)² i=1
WeightedStandardDeviation ( this matrix, int weights, double means ) : double[]

Calculates the matrix Standard Deviations vector.

WeightedStandardDeviation ( this matrix, int weights, double means, bool unbiased = true ) : double[]

Calculates the matrix Standard Deviations vector.

Setting unbiased to true will make this method compute the standard deviation σ using the sample variance, which is an unbiased estimator of the true population variance. Setting this parameter to true will thus compute σ using the following formula:

N σ² = 1 / (N - 1) ∑ (x_i − μ)² i=1

Setting unbiased to false will assume the given values already represent the whole population, and will compute the population variance using the formula:

N σ² = (1 / N) ∑ (x_i − μ)² i=1

Private Methods

Method Description
correct ( bool unbiased, WeightType weightType, double sum, double weightSum, double squareSum ) : double

Method Details

GetHistogramRange() public static method

Get range around median of an histogram containing specified percentage of values.

The input array is treated as histogram, i.e. its indexes are treated as values of stochastic function, but array values are treated as "probabilities" (total amount of hits).

The method calculates range of stochastic variable, which summary probability comprises the specified percentage of histogram's hits.

public static GetHistogramRange ( this values, double percent ) : IntRange
values this Histogram array.
percent double Values percentage around median.
return IntRange

HistogramEntropy() public static method

Calculate entropy value of an histogram.

The input array is treated as histogram, i.e. its indexes are treated as values of stochastic function, but array values are treated as "probabilities" (total amount of hits).

public static HistogramEntropy ( this values ) : double
values this Histogram array.
return double

HistogramMax() public static method

Gets the maximum value in the histogram.
public static HistogramMax ( this values ) : int
values this Histogram array.
return int

HistogramMean() public static method

Calculate mean value of an histogram.

The input array is treated as histogram, i.e. its indexes are treated as values of stochastic function, but array values are treated as "probabilities" (total amount of hits).

public static HistogramMean ( this values ) : double
values this Histogram array.
return double

HistogramMedian() public static method

Calculate median value of an histogram.

The input array is treated as histogram, i.e. its indexes are treated as values of stochastic function, but array values are treated as "probabilities" (total amount of hits).

The median value is calculated accumulating histogram's values starting from the left point until the sum reaches 50% of histogram's sum.

public static HistogramMedian ( this values ) : int
values this Histogram array.
return int

HistogramMin() public static method

Gets the minimum value in the histogram.
public static HistogramMin ( this values ) : int
values this Histogram array.
return int

HistogramMode() public static method

Calculate mode value of an histogram.

The input array is treated as histogram, i.e. its indexes are treated as values of stochastic function, but array values are treated as "probabilities" (total amount of hits).

Returns the minimum mode value if the specified histogram is multimodal.

public static HistogramMode ( this values ) : int
values this Histogram array.
return int

HistogramStandardDeviation() public static method

Calculate standard deviation of an histogram.

The input array is treated as histogram, i.e. its indexes are treated as values of stochastic function, but array values are treated as "probabilities" (total amount of hits).

public static HistogramStandardDeviation ( this values ) : double
values this Histogram array.
return double

HistogramStandardDeviation() public static method

Calculate standard deviation of an histogram.

The input array is treated as histogram, i.e. its indexes are treated as values of stochastic function, but array values are treated as "probabilities" (total amount of hits).

The method is an equivalent to the HistogramStandardDeviation(int[]) method, but it relies on the passed mean value, which is previously calculated using HistogramMean method.

public static HistogramStandardDeviation ( this values, double mean ) : double
values this Histogram array.
mean double Mean value of the histogram.
return double

HistogramSum() public static method

Calculates the total number of samples in a histogram.
public static HistogramSum ( this values ) : long
values this The histogram array.
return long

WeightedCovariance() public static method

Calculates the scatter matrix of a sample matrix.
By dividing the Scatter matrix by the sample size, we get the population Covariance matrix. By dividing by the sample size minus one, we get the sample Covariance matrix.
public static WeightedCovariance ( double matrix, double weights, double means ) : ].double[
matrix double A number multi-dimensional array containing the matrix values.
weights double An unit vector containing the importance of each sample /// in . The sum of this array elements should add up to 1.
means double The mean value of the given values, if already known.
return ].double[

WeightedCovariance() public static method

Calculates the scatter matrix of a sample matrix.
By dividing the Scatter matrix by the sample size, we get the population Covariance matrix. By dividing by the sample size minus one, we get the sample Covariance matrix.
public static WeightedCovariance ( double matrix, double weights, double means, int dimension ) : ].double[
matrix double A number multi-dimensional array containing the matrix values.
weights double An unit vector containing the importance of each sample /// in . The sum of this array elements should add up to 1.
means double The mean value of the given values, if already known.
dimension int /// Pass 0 to if mean vector is a row vector, 1 otherwise. Default value is 0. ///
return ].double[

WeightedCovariance() public static method

Calculates the scatter matrix of a sample matrix.
By dividing the Scatter matrix by the sample size, we get the population Covariance matrix. By dividing by the sample size minus one, we get the sample Covariance matrix.
public static WeightedCovariance ( double matrix, double weights, int dimension ) : ].double[
matrix double A number multi-dimensional array containing the matrix values.
weights double An unit vector containing the importance of each sample /// in . The sum of this array elements should add up to 1.
dimension int /// Pass 0 to if mean vector is a row vector, 1 otherwise. Default value is 0. ///
return ].double[

WeightedCovariance() public static method

Calculates the scatter matrix of a sample matrix.
By dividing the Scatter matrix by the sample size, we get the population Covariance matrix. By dividing by the sample size minus one, we get the sample Covariance matrix.
public static WeightedCovariance ( double matrix, int weights, double means, int dimension ) : ].double[
matrix double A number multi-dimensional array containing the matrix values.
weights int The number of times each sample should be repeated.
means double The mean value of the given values, if already known.
dimension int /// Pass 0 to if mean vector is a row vector, 1 otherwise. Default value is 0. ///
return ].double[

WeightedCovariance() public static method

Calculates the scatter matrix of a sample matrix.
By dividing the Scatter matrix by the sample size, we get the population Covariance matrix. By dividing by the sample size minus one, we get the sample Covariance matrix.
public static WeightedCovariance ( double matrix, int weights, int dimension ) : ].double[
matrix double A number multi-dimensional array containing the matrix values.
weights int The number of times each sample should be repeated.
dimension int /// Pass 0 to if mean vector is a row vector, 1 otherwise. Default value is 0. ///
return ].double[

WeightedMean() public static method

Calculates the weighted matrix Mean vector.
public static WeightedMean ( double matrix, double weights, int dimension ) : double[]
matrix double A matrix whose means will be calculated.
weights double A vector containing the importance of each sample in the matrix.
dimension int /// The dimension along which the means will be calculated. Pass /// 0 to compute a row vector containing the mean of each column, /// or 1 to compute a column vector containing the mean of each row. /// Default value is 0. ///
return double[]

WeightedMean() public static method

Calculates the weighted matrix Mean vector.
public static WeightedMean ( double matrix, int weights, int dimension ) : double[]
matrix double A matrix whose means will be calculated.
weights int A vector containing the importance of each sample in the matrix.
dimension int /// The dimension along which the means will be calculated. Pass /// 0 to compute a row vector containing the mean of each column, /// or 1 to compute a column vector containing the mean of each row. /// Default value is 0. ///
return double[]

WeightedMean() public static method

Calculates the weighted matrix Mean vector.
public static WeightedMean ( this matrix, double weights ) : double[]
matrix this A matrix whose means will be calculated.
weights double A vector containing the importance of each sample in the matrix.
return double[]

WeightedMean() public static method

Calculates the weighted matrix Mean vector.
public static WeightedMean ( this matrix, int weights ) : double[]
matrix this A matrix whose means will be calculated.
weights int A vector containing the importance of each sample in the matrix.
return double[]

WeightedScatter() public static method

Calculates the scatter matrix of a sample matrix.
By dividing the Scatter matrix by the sample size, we get the population Covariance matrix. By dividing by the sample size minus one, we get the sample Covariance matrix.
public static WeightedScatter ( double matrix, double weights, double means, double factor, int dimension ) : ].double[
matrix double A number multi-dimensional array containing the matrix values.
weights double An unit vector containing the importance of each sample /// in . The sum of this array elements should add up to 1.
means double The mean value of the given values, if already known.
factor double A real number to multiply each member of the matrix.
dimension int /// Pass 0 to if mean vector is a row vector, 1 otherwise. Default value is 0. ///
return ].double[

WeightedScatter() public static method

Calculates the scatter matrix of a sample matrix.
By dividing the Scatter matrix by the sample size, we get the population Covariance matrix. By dividing by the sample size minus one, we get the sample Covariance matrix.
public static WeightedScatter ( double matrix, int weights, double means, double factor, int dimension ) : ].double[
matrix double A number multi-dimensional array containing the matrix values.
weights int The number of times each sample should be repeated.
means double The mean value of the given values, if already known.
factor double A real number to multiply each member of the matrix.
dimension int /// Pass 0 to if mean vector is a row vector, 1 otherwise. Default value is 0. ///
return ].double[

WeightedStandardDeviation() public static method

Calculates the matrix Standard Deviations vector.
public static WeightedStandardDeviation ( this matrix, double weights ) : double[]
matrix this A matrix whose deviations will be calculated.
weights double The number of times each sample should be repeated.
return double[]

WeightedStandardDeviation() public static method

Calculates the matrix Standard Deviations vector.

Setting unbiased to true will make this method compute the standard deviation σ using the sample variance, which is an unbiased estimator of the true population variance. Setting this parameter to true will thus compute σ using the following formula:

N σ² = 1 / (N - 1) ∑ (x_i − μ)² i=1

Setting unbiased to false will assume the given values already represent the whole population, and will compute the population variance using the formula:

N σ² = (1 / N) ∑ (x_i − μ)² i=1
public static WeightedStandardDeviation ( this matrix, double weights, bool unbiased = true ) : double[]
matrix this A matrix whose deviations will be calculated.
weights double The number of times each sample should be repeated.
unbiased bool /// Pass true to compute the standard deviation using the sample variance. /// Pass false to compute it using the population variance. See remarks /// for more details.
return double[]

WeightedStandardDeviation() public static method

Calculates the matrix Standard Deviations vector.
public static WeightedStandardDeviation ( this matrix, double weights, double means ) : double[]
matrix this A matrix whose deviations will be calculated.
weights double The number of times each sample should be repeated.
means double The mean vector containing already calculated means for each column of the matrix.
return double[]

WeightedStandardDeviation() public static method

Calculates the matrix Standard Deviations vector.

Setting unbiased to true will make this method compute the standard deviation σ using the sample variance, which is an unbiased estimator of the true population variance. Setting this parameter to true will thus compute σ using the following formula:

N σ² = 1 / (N - 1) ∑ (x_i − μ)² i=1

Setting unbiased to false will assume the given values already represent the whole population, and will compute the population variance using the formula:

N σ² = (1 / N) ∑ (x_i − μ)² i=1
public static WeightedStandardDeviation ( this matrix, double weights, double means, bool unbiased = true ) : double[]
matrix this A matrix whose deviations will be calculated.
weights double The number of times each sample should be repeated.
means double The mean vector containing already calculated means for each column of the matrix.
unbiased bool /// Pass true to compute the standard deviation using the sample variance. /// Pass false to compute it using the population variance. See remarks /// for more details.
return double[]

WeightedStandardDeviation() public static method

Calculates the matrix Standard Deviations vector.
public static WeightedStandardDeviation ( this matrix, int weights ) : double[]
matrix this A matrix whose deviations will be calculated.
weights int The number of times each sample should be repeated.
return double[]

WeightedStandardDeviation() public static method

Calculates the matrix Standard Deviations vector.

Setting unbiased to true will make this method compute the standard deviation σ using the sample variance, which is an unbiased estimator of the true population variance. Setting this parameter to true will thus compute σ using the following formula:

N σ² = 1 / (N - 1) ∑ (x_i − μ)² i=1

Setting unbiased to false will assume the given values already represent the whole population, and will compute the population variance using the formula:

N σ² = (1 / N) ∑ (x_i − μ)² i=1
public static WeightedStandardDeviation ( this matrix, int weights, bool unbiased = true ) : double[]
matrix this A matrix whose deviations will be calculated.
weights int The number of times each sample should be repeated.
unbiased bool /// Pass true to compute the standard deviation using the sample variance. /// Pass false to compute it using the population variance. See remarks /// for more details.
return double[]

WeightedStandardDeviation() public static method

Calculates the matrix Standard Deviations vector.
public static WeightedStandardDeviation ( this matrix, int weights, double means ) : double[]
matrix this A matrix whose deviations will be calculated.
weights int The number of times each sample should be repeated.
means double The mean vector containing already calculated means for each column of the matrix.
return double[]

WeightedStandardDeviation() public static method

Calculates the matrix Standard Deviations vector.

Setting unbiased to true will make this method compute the standard deviation σ using the sample variance, which is an unbiased estimator of the true population variance. Setting this parameter to true will thus compute σ using the following formula:

N σ² = 1 / (N - 1) ∑ (x_i − μ)² i=1

Setting unbiased to false will assume the given values already represent the whole population, and will compute the population variance using the formula:

N σ² = (1 / N) ∑ (x_i − μ)² i=1
public static WeightedStandardDeviation ( this matrix, int weights, double means, bool unbiased = true ) : double[]
matrix this A matrix whose deviations will be calculated.
weights int The number of times each sample should be repeated.
means double The mean vector containing already calculated means for each column of the matrix.
unbiased bool /// Pass true to compute the standard deviation using the sample variance. /// Pass false to compute it using the population variance. See remarks /// for more details.
return double[]