leaspy.samplers.base¶
Classes¶
Abstract sampler class. |
|
Abstract class for samplers of individual random variables. |
|
Abstract class for samplers of population random variables. |
Module Contents¶
- class AbstractSampler(name, shape, *, acceptation_history_length=25)[source]¶
Bases:
abc.ABCAbstract sampler class.
- Parameters:
- name
str The name of the random variable to sample.
- shape
tupleofint The shape of the random variable to sample.
- acceptation_history_length
int> 0 (default 25) Deepness (= number of iterations) of the history kept for computing the mean acceptation rate. (It is the same for population or individual variables.)
- name
- Attributes:
- name
str Name of variable
- shape
tupleofint Shape of variable
- acceptation_history_length
int Deepness (= number of iterations) of the history kept for computing the mean acceptation rate. (Same for population or individual variables by default.)
- acceptation_history
torch.Tensor History of binary acceptations to compute mean acceptation rate for the sampler in MCMC-SAEM algorithm. It keeps the history of the last acceptation_history_length steps.
- name
- Raises:
- Parameters:
- name¶
- shape¶
- acceptation_history_length = 25¶
- acceptation_history¶
- property shape_acceptation: Tuple[int, Ellipsis]¶
- Abstractmethod:
- Return type:
Tuple[int, Ellipsis]
Return the shape of acceptation tensor for a single iteration.
- class AbstractIndividualSampler(name, shape, *, n_patients, acceptation_history_length=25)[source]¶
Bases:
AbstractSamplerAbstract class for samplers of individual random variables.
- Parameters:
- name
str The name of the random variable to sample.
- shape
tupleofint The shape of the random variable to sample.
- n_patients
int Number of patients.
- acceptation_history_length
int> 0 (default 25) Deepness (= number of iterations) of the history kept for computing the mean acceptation rate. (It is the same for population or individual variables.)
- name
- Attributes:
- name
str Name of variable
- shape
tupleofint Shape of variable
- n_patients
int Number of patients.
- acceptation_history_length
int Deepness (= number of iterations) of the history kept for computing the mean acceptation rate. (It is the same for population or individual variables.)
- acceptation_history
torch.Tensor History of binary acceptations to compute mean acceptation rate for the sampler in MCMC-SAEM algorithm. It keeps the history of the last acceptation_history_length steps.
- name
- Parameters:
- n_patients¶
- class AbstractPopulationSampler(name, shape, *, acceptation_history_length=25, mask=None)[source]¶
Bases:
AbstractSamplerAbstract class for samplers of population random variables.
- Parameters:
- name
str The name of the random variable to sample.
- shape
tupleofint The shape of the random variable to sample.
- acceptation_history_length
int> 0 (default 25) Deepness (= number of iterations) of the history kept for computing the mean acceptation rate. (It is the same for population or individual variables.)
- mask
torch.Tensor, optional A binary (0/1) tensor indicating which elements to sample. Elements with value 1 (True) are included in the sampling; elements with 0 (False) are excluded.
- name
- Attributes:
- name
str Name of variable
- shape
tupleofint Shape of variable
- acceptation_history_length
int Deepness (= number of iterations) of the history kept for computing the mean acceptation rate. (It is the same for population or individual variables.)
- acceptation_history
torch.Tensor History of binary acceptations to compute mean acceptation rate for the sampler in MCMC-SAEM algorithm. It keeps the history of the last acceptation_history_length steps.
- mask
torch.Tensorofbool, optional A binary (0/1) tensor indicating which elements to sample. Elements with value 1 (True) are included in the sampling; elements with 0 (False) are excluded.
- name
- Parameters:
- mask = None¶