exp_utils module#

class permanova.experiments.exp_utils.NumpyTest[source]#

Bases: object

class to perform tabular tests with the NumPy implementation of LightPERMANOVA

static generate_samples_with_mixture_covariates(dim: int, noise_mean_factor: float, noise_std_factor: float, size: int) tuple[source]#

Generates samples with covariates drawn from mixture of two gaussians

Parameters:
  • dim (int) – number of covariates that describe the samples

  • noise_mean_factor (float) – to each of the gaussians of sample_2 will be applied a noise with mean = noise_mean_factor * original mean of the gaussian

  • noise_std_factor (float) – to each of the gaussians of sample_2 will be applied a noise with std = noise_std_factor * original std of the gaussian

  • size (int) – size of the samples

Returns:

(sample_1: np.ndarray, sample_2: np.ndarray)

Return type:

tuple

static generate_samples_with_normal_covariates(dim: int, noise_mean: float, noise_std: float, size: int) tuple[source]#

Generates samples with normally distributed covariates

Parameters:
  • dim (int) – number of covariates that describe the samples

  • noise_mean (float) – mean of the noise applied to each variable of the original sample

  • noise_std (float) – std of the noise applied to each variable of the original sample

  • size (int) – size of the samples

Returns:

(sample_1: np.ndarray, sample_2: np.ndarray)

Return type:

tuple

static plot_distributions(sample_1: ndarray, sample_2: ndarray)[source]#

Plots the comparison of the distributions for each variable in the samples.

Parameters:
  • sample_1 (np.ndarray) – original sample

  • sample_2 (np.ndarray) – sample with noise

static test(sample_1, sample_2, show_plots: bool = False)[source]#
class permanova.experiments.exp_utils.TorchTest[source]#

Bases: object

class to perform tabular tests with the PyTorch implementation of LightPERMANOVA

static generate_samples_with_mixture_covariates(dim: int, noise_mean_factor: float, noise_std_factor: float, size: int)[source]#

Generates samples with covariates drawn from mixture of two gaussians

Parameters:
  • dim (int) – number of covariates that describe the samples

  • noise_mean_factor (float) – to each of the gaussians of sample_2 will be applied a noise with mean = noise_mean_factor * original mean of the gaussian

  • noise_std_factor (float) – to each of the gaussians of sample_2 will be applied a noise with std = noise_std_factor * original std of the gaussian

  • size (int) – size of the samples

Returns:

(sample_1: np.ndarray, sample_2: np.ndarray)

Return type:

tuple

static generate_samples_with_normal_covariates(dim: int, noise_mean: float, noise_std: float, size: int)[source]#

Generates samples with normally distributed covariates

Parameters:
  • dim (int) – number of covariates that describe the samples

  • noise_mean (float) – mean of the noise applied to each variable of the original sample

  • noise_std (float) – std of the noise applied to each variable of the original sample

  • size (int) – size of the samples

Returns:

(sample_1: np.ndarray, sample_2: np.ndarray)

Return type:

tuple

static plot_distributions(sample_1: Tensor, sample_2: Tensor)[source]#

Plots the comparison of the distributions for each variable in the samples.

Parameters:
  • sample_1 (np.ndarray) – original sample

  • sample_2 (np.ndarray) – sample with noise

static test(sample_1: Tensor, sample_2: Tensor, show_plots: bool = False)[source]#