Table of Contents

Class PreprocessingRoutines

Namespace
NeuralNetworks.Core
Assembly
NeuralNetworks.dll

Provides preprocessing routines for numeric array data, including scaling and standardization operations for 2D and 4D float arrays.

public static class PreprocessingRoutines
Inheritance
PreprocessingRoutines
Inherited Members

Remarks

Includes methods that operate in place and methods that return transformed copies. Supports whole-array, row-wise, and column-wise standardization, optional range-based targeting, and safeguards for zero-variance data to avoid division by zero.

Methods

ApplyStandardizationInPlace(float[,,,], float, float)

Apply standardization to the 4D array in place by subtracting the given mean and dividing by the given standard deviation.

public static void ApplyStandardizationInPlace(this float[,,,] data, float mean, float stdDev)

Parameters

data float[,,,]
mean float
stdDev float

ApplyStandardizationInPlace(float[,], float, float)

Standardize the 2D array in place by subtracting the given mean and dividing by the given standard deviation.

public static void ApplyStandardizationInPlace(this float[,] data, float mean, float stdDev)

Parameters

data float[,]
mean float
stdDev float

ScaleTo(float[,], float, float)

public static float[,] ScaleTo(this float[,] data, float newMin, float newMax)

Parameters

data float[,]
newMin float
newMax float

Returns

float[,]

ScaleToInPlace(float[,], float, float)

public static void ScaleToInPlace(this float[,] data, float newMin, float newMax)

Parameters

data float[,]
newMin float
newMax float

StandardizeByColumns(float[,], Range?)

Standardizes the source in-place so that each column (or a specified range of columns) has a mean of 0 and a standard deviation of 1 by applying the (x - mean) / stdDev transformation.

public static void StandardizeByColumns(this float[,] source, Range? columnRange = null)

Parameters

source float[,]

The source to standardize.

columnRange Range?

Optional. The range of columns to standardize. If null, all columns are standardized.

Remarks

Standard deviation is calculated using the formula: sqrt(sum((x - mean)^2) / N), where N is the number of rows.

StandardizeByRows(float[,], Range?)

public static float[,] StandardizeByRows(this float[,] source, Range? rowRange = null)

Parameters

source float[,]
rowRange Range?

Returns

float[,]

StandardizeByRowsInPlace(float[,], Range?)

public static void StandardizeByRowsInPlace(this float[,] source, Range? rowRange = null)

Parameters

source float[,]
rowRange Range?

StandardizeColumns(float, params List<float[,]>)

public static void StandardizeColumns(float minStdDev, params List<float[,]> sets)

Parameters

minStdDev float
sets List<float[,]>

StandardizeInPlace(float[,,,])

Standardize the 4D array in place by subtracting the mean and dividing by the standard deviation, and return the mean and standard deviation used for standardization.

public static (float Mean, float StdDev) StandardizeInPlace(this float[,,,] data)

Parameters

data float[,,,]

Returns

(float Mean, float StdDev)

StandardizeInPlace(float[,])

Standardize the 2D array in place by subtracting the mean and dividing by the standard deviation, and return the mean and standard deviation used for standardization.

public static (float Mean, float StdDev) StandardizeInPlace(this float[,] data)

Parameters

data float[,]

Returns

(float Mean, float StdDev)

StandardizeSinglePass(float[,], Range?)

Standardizes the source in-place so that each column (or a specified range of columns) has mean 0 and standard deviation 1, computed in a single pass.

public static void StandardizeSinglePass(this float[,] source, Range? columnRange = null)

Parameters

source float[,]

The source to standardize.

columnRange Range?

Optional. The range of columns to standardize. If null, all columns are standardized.