batchMeans

fun batchMeans(data: DoubleArray, numBatches: Int): DoubleArray

Takes an array of length, n, and computes k batch means where each batch mean is the average of batchSize (b) elements such that b = Math.FloorDiv(n, k). If the number of batches, k, does not divide evenly into n, then n - (k*b) observations are not processed at the end of the array.

The batch means are contained in the returned array.

Return

an array of the batch means

Parameters

data

the data to batch, must not be null, and must have at least batchSize elements

numBatches

the number of batches (k), must be less than or equal to n and greater than 0


fun batchMeans(matrix: Array<DoubleArray>, numBatches: Int): Array<DoubleArray>

Each array in the matrix is batched into the supplied number of batches

Return

the returned array has the row order as the original array, but the original array has been batched to contain the (k) batch means of the data.

Parameters

matrix

the matrix of data, each row is an array, all arrays must be the same size i.e. a rectangular matrix

numBatches

the number of batches (k), must be less than or equal to n and greater than 0


fun batchMeans(data: Map<String, DoubleArray>, numBatches: Int): Map<String, DoubleArray>

Each array in the data map is batched into the supplied number of batches. The map must be rectangular. That is all arrays are of the same size

Return

the returned array has the same key as the original array, but the original array has been batched to contain the (k) batch means of the data.

Parameters

numBatches

the number of batches (k), must be less than or equal to n and greater than 0