brine.examples module#

brine.examples.generate_X(m: int = 1000, n: int = 2000, seed: int = 123) ndarray[source]#

Generates a signal matrix with 10 strong principal values and 10 weak principal values.

Parameters:
m: int, optional

The number of rows (default=1000)

n: int, optional

The number of rows (default=2000)

seed: int, optional

The random seed (default=123)

Returns:
numpy.ndarray

The data matrix

brine.examples.generate_Y_with_almost_homoskedastic_noise(m: int = 1000, n: int = 2000, seed: int = 123) ndarray[source]#

Generates a test matrix with 10 strong principal values and 10 weak principal values.

The noise is homoskedastic except for the last 5 rows and columns where it is abnormally strong

Parameters:
m: int, optional

The number of rows (default=1000)

n: int, optional

The number of rows (default=2000)

seed: int, optional

The random seed (default=123)

Returns:
numpy.ndarray

The data matrix

See also

generate_X
brine.examples.generate_Y_with_block_variance_profile(m: int = 1000, n: int = 2000, n_high_variance: int = 10, high_variance_multiplier: float = 50, n_strong: int = 10, n_weak: int = 10, s_strong_multiplier: float = 4, s_weak_multiplier: float = 0.6, seed: int = 123) ndarray[source]#

Generates a test matrix with strong and weak principal values.

The noise has a 2x2 block variance profile (relative variances [[0.1, 1], [10, 1]] over row/column groups of size m/2 and n/2), plus a number of scattered high-variance rows and columns. The signal singular values are set relative to the noise bulk edge (the (2 * n_high_variance + 1)-th largest eigenvalue of E @ E.T).

Parameters:
m: int, optional

The number of rows (default=1000)

n: int, optional

The number of rows (default=2000)

n_high_variance: int, optional

The number of scattered high-variance rows, and separately columns (default=10)

high_variance_multiplier: float, optional

The factor by which the variance of the high-variance rows and columns is multiplied (default=50)

n_strong: int, optional

The number of strong signal components (default=10)

n_weak: int, optional

The number of weak signal components (default=10)

s_strong_multiplier: float, optional

The strong signal singular values are set to s_strong_multiplier * sqrt(tau_bulk) (default=4)

s_weak_multiplier: float, optional

The weak signal singular values are set to s_weak_multiplier * sqrt(tau_bulk) (default=0.6)

seed: int, optional

The random seed (default=123)

Returns:
numpy.ndarray

The data matrix

brine.examples.generate_Y_with_heteroskedastic_noise(m: int = 1000, n: int = 2000, noise_dimensions: int = 10, seed: int = 123) ndarray[source]#

Generates a test matrix with 10 strong principal values and 10 weak principal values.

Parameters:
m: int, optional

The number of rows (default=1000)

n: int, optional

The number of rows (default=2000)

noise_dimensions: int, optional

The number of noise dimensions (default=10)

seed: int, optional

The random seed (default=123)

Returns:
numpy.ndarray

The data matrix

See also

generate_X