Table of Contents

Class ArrayUtils

Namespace
NeuralNetworks.Core
Assembly
NeuralNetworks.dll
public class ArrayUtils
Inheritance
ArrayUtils
Inherited Members

Methods

BoxMuller(Random)

Generates a random number following a standard normal distribution (mean = 0, stdDev = 1) using the Box-Muller transform.

public static float BoxMuller(Random random)

Parameters

random Random

Returns

float

CreateRandom(int, int, int, int, Random)

public static float[,,,] CreateRandom(int dim1, int dim2, int dim3, int dim4, Random _random)

Parameters

dim1 int
dim2 int
dim3 int
dim4 int
_random Random

Returns

float[,,,]

CreateRandom(int, int, Random)

Creates a new matrix filled with random values between -0.5 and 0.5, with the specified number of rows and columns.

public static float[,] CreateRandom(int rows, int columns, Random random)

Parameters

rows int

The number of rows in the matrix.

columns int

The number of columns in the matrix.

random Random

The random number generator.

Returns

float[,]

A new matrix filled with random values.

CreateRandom(int, Random)

public static float[] CreateRandom(int columns, Random random)

Parameters

columns int
random Random

Returns

float[]

CreateRandomNormal(int, int, int, int, Random, float, float)

public static float[,,,] CreateRandomNormal(int dim1, int dim2, int dim3, int dim4, Random random, float mean = 0, float stdDev = 1)

Parameters

dim1 int
dim2 int
dim3 int
dim4 int
random Random
mean float
stdDev float

Returns

float[,,,]

CreateRandomNormal(int, int, Random, float, float)

public static float[,] CreateRandomNormal(int rows, int columns, Random random, float mean = 0, float stdDev = 1)

Parameters

rows int
columns int
random Random
mean float
stdDev float

Returns

float[,]

CreateRandomNormal(int, Random, float, float)

public static float[] CreateRandomNormal(int columns, Random random, float mean = 0, float stdDev = 1)

Parameters

columns int
random Random
mean float
stdDev float

Returns

float[]

CreateRange(int, int, int, int, float, float)

public static float[,,,] CreateRange(int dim1, int dim2, int dim3, int dim4, float from, float to)

Parameters

dim1 int
dim2 int
dim3 int
dim4 int
from float
to float

Returns

float[,,,]

CreateRange(int, int, float, float)

public static float[,] CreateRange(int rows, int columns, float from, float to)

Parameters

rows int
columns int
from float
to float

Returns

float[,]

EnsureSameShape(float[,,,]?, float[,,,]?)

[Conditional("DEBUG")]
public static void EnsureSameShape(float[,,,]? matrix1, float[,,,]? matrix2)

Parameters

matrix1 float[,,,]
matrix2 float[,,,]

EnsureSameShape(float[,]?, float[,]?)

[Conditional("DEBUG")]
public static void EnsureSameShape(float[,]? matrix1, float[,]? matrix2)

Parameters

matrix1 float[,]
matrix2 float[,]

EnsureSameShape(float[]?, float[]?)

[Conditional("DEBUG")]
public static void EnsureSameShape(float[]? matrix1, float[]? matrix2)

Parameters

matrix1 float[]
matrix2 float[]

LoadCsv(string, int)

public static float[,] LoadCsv(string filePath, int skipHeaderLines = 0)

Parameters

filePath string
skipHeaderLines int

Returns

float[,]

PermuteData(float[,,,], float[,], Random)

Permutes the data in the input arrays x and y using the provided random number generator.

public static (float[,,,] xPermuted, float[,] yPermuted) PermuteData(float[,,,] x, float[,] y, Random random)

Parameters

x float[,,,]
y float[,]
random Random

Returns

(float[,,,] xPermuted, float[,] yPermuted)

Remarks

This method is the quickest way to permute data for 4D input arrays.

PermuteData(float[,], float[,], Random)

public static (float[,] xPermuted, float[,] yPermuted) PermuteData(float[,] x, float[,] y, Random random)

Parameters

x float[,]
y float[,]
random Random

Returns

(float[,] Set1, float[,] Set2)

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

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

Parameters

minStdDev float
sets List<float[,]>