pymgipsim.Probability.pdfs_samplers


Functions

generate_normalized_pdfs

Generate and normalize probability density functions (PDFs) for a given distribution.

generate_random_percentages

Generates random percentage values for a given number of subjects, meals, and days.

sample_generator

sample_pdfs

Sample values from a given normalized probability density function (PDF).

generate_normalized_pdfs(distribution_name, **pdf_parameters)[source]

Generate and normalize probability density functions (PDFs) for a given distribution.

Parameters: - distribution_name: str

Name of the probability distribution.

  • *pdf_parameters: variable arguments

    Parameters needed for the specified distribution.

Returns: - normalized_pdf: np.ndarray

Normalized PDF values for the specified distribution.

generate_random_percentages(number_of_days, number_of_subjects, number_of_meals, lower_limit=0.2, upper_limit=0.6)[source]

Generates random percentage values for a given number of subjects, meals, and days.

Parameters: - number_of_days (int): The number of days. - lower_limit (float): The lower limit for random percentage generation. - upper_limit (float): The upper limit for random percentage generation. - number_of_subjects (int): The number of subjects. - number_of_meals (int): The number of meals.

Returns: - percentages (numpy.ndarray): A 3D array of random percentages with dimensions (number_of_subjects, number_of_days, number_of_meals) where the sum along the second axis is 1.

sample_pdfs(normalized_pdf, sample_range, sample_size, rng_generator)[source]

Sample values from a given normalized probability density function (PDF).

Parameters: - normalized_pdf: np.ndarray

Normalized PDF values.

  • sample_range: np.ndarray

    Range of values to sample from.

  • sample_size: int

    Number of samples to generate.

  • rng_generator

Returns: - samples: np.ndarray

Sampled values based on the given PDF.