ssd.utils.matrix module
SSD - Utilities
Utility functions for the Stochastic Signal Detection project.
- ssd.utils.matrix.create_bulk(rows: int, ratio: float, random_state: int | Generator | None = None, **kwargs) ndarray[source]
Create a bulk distribution matrix.
- Parameters:
rows (int) – Number of rows (data vectors) of the matrix.
ratio (float) – Ratio between the number of columns (variables) and the number of rows (data vectors).
random_state (Optional[Union[int, np.random.Generator]], optional) – Random state, by default None. It can be an integer, in which case it is used as the seed for the default random number generator, or a
Generatorobject (see numpy).kwargs (dict) – Additional keyword arguments to pass to the random distribution (
np.random.normal).
- Returns:
Bulk distribution matrix.
- Return type:
np.ndarray
- Raises:
TypeError – If the random state is not an integer or a
Generatorobject.
- ssd.utils.matrix.create_signal(rows: int, ratio: float, rank: int, random_state: int | Generator | None = None, **kwargs) ndarray[source]
Create a signal matrix.
- Parameters:
rows (int) – Number of rows (data vectors) of the matrix.
ratio (float) – Ratio between the number of columns (variables) and the number of rows (data vectors).
rank (int) – Rank of the signal matrix.
random_state (Optional[Union[int, np.random.Generator]], optional) –
Random state, by default None. It can be an integer, in which case it is used as the seed for the default random number generator, or a
Generatorobject (see numpy).kwargs (dict) – Additional keyword arguments to pass to the random distribution (
np.random.normal).
- Returns:
Signal matrix.
- Return type:
np.ndarray
- Raises:
TypeError – If the random state is not an integer or a
Generatorobject.
ssd.utils.plots module
SSD - plotting utilities
Some utility functions for plotting and displaying the results of the simulation.
- ssd.utils.plots.plot_inverse_mp_distribution(evl: list, x: list, y: list, y_dist: list, k2min: float | None = None, k2max: float | None = None, bins: int = 1000, output: str = 'output_dir', subprefix: str = 'mp_inv_dist')[source]
Plot the inverse Marchenko-Pastur distribution.
- Parameters:
evl (list) – Inverse eigenvalues of the covariance matrix
x (list) – x values of the distributions
y (list) – y values of the MP distribution (inverse)
y_dist (list) – y values of the empirical distribution
k2min (float, optional) – Lower bound of the integration interval, by default None
k2max (float, optional) – Upper bound of the integration interval, by default None
bins (int, optional) – Number of bins for the histogram, by default 1000
output (str, optional) – Output directory, by default ‘output_dir’
subprefix (str, optional) – Prefix of the output files, by default ‘mp_inv_dist’
- ssd.utils.plots.plot_mp_distribution(evl: list, x: list, y: list, n_bins: int = 100, output: str = 'output_dir', subprefix: str = 'mp_dist')[source]
Plot the Marchenko-Pastur distribution.
- Parameters:
evl (list) – Eigenvalues of the covariance matrix
x (list) – x values of the MP distribution
y (list) – y values of the MP distribution
n_bins (int, optional) – Number of bins for the histogram, by default 100
output (str, optional) – Output directory, by default ‘output_dir’
subprefix (str, optional) – Prefix of the output files, by default ‘mp_dist’
- ssd.utils.plots.plot_potential(xinf: float = 0.0, xsup: float = 0.0, nval: int = 1000, mu1: float = 0.0, mu2: float = 1.0, mu3: float = 0.0, output: str = 'output_dir', prefix: str = 'initial_potential')[source]
Plot the initial potential.
- Parameters:
xinf (float, optional) – Lower bound of the domain, by default 0.0
xsup (float, optional) – Upper bound of the domain, by default 0.0
nval (int, optional) – Number of grid points, by default 1000
mu1 (float, optional) – Mass parameter (quadratic term), by default 0.0
mu2 (float, optional) – Quartic term, by default 1.0
mu3 (float, optional) – 6th power term, by default 0.0
output (str, optional) – Output directory, by default ‘output_dir’
prefix (str, optional) – Prefix of the output files, by default ‘initial_potential’