leaspy.io.logs.visualization.plotter¶
Classes¶
Class defining some plotting tools. |
Module Contents¶
- class Plotter(output_path=None)[source]¶
Class defining some plotting tools.
- Parameters:
- output_path
str, (optional) Folder where plots will be saved. If None, default to current working directory.
- output_path
- Parameters:
output_path (Optional[str])
- output_path = None¶
- plt_show()[source]¶
Display the current matplotlib figure if self._show is True.
This method wraps matplotlib.pyplot.show using the internal flags _show and _block to control interactive plotting.
- plot_mean_trajectory(model, *, n_pts=100, n_std_left=3, n_std_right=6, **kwargs)[source]¶
Plot the mean model trajectory.
- Parameters:
- model
McmcSaemCompatibleModelor iterable of such Model(s) to compute the mean trajectory for.
- n_pts
int, optional Number of timepoints to evaluate between the start and end. Default=100.
- n_std_left
int, optional How many standard deviations before the mean to plot. Default=3.
- n_std_right
int, optional How many standard deviations after the mean to plot. Default=6.
- **kwargs
- model
- Raises:
- LeaspyInputError
If the model(s) is/are not initialized.
- Parameters:
model (McmcSaemCompatibleModel)
n_pts (int)
n_std_left (int)
n_std_right (int)
- plot_mean_validity(model, results, **kwargs)[source]¶
Plot histogram of reparametrized times for all individuals.
- Parameters:
- model
McmcSaemCompatibleModel Fitted model providing tau_mean and tau_std.
- resultsobject
Results containing data and individual_parameters with keys
xiandtau.- **kwargs
save_as:str, filename to save the plot.
- model
- Parameters:
model (McmcSaemCompatibleModel)
- Return type:
None
- plot_patient_trajectory(model, results, indices, **kwargs)[source]¶
Plot observed data and reconstructed trajectory for one or more patients.
- Parameters:
- Parameters:
model (McmcSaemCompatibleModel)
- Return type:
None
- plot_from_individual_parameters(model, indiv_parameters, timepoints, **kwargs)[source]¶
Plot a trajectory computed from given individual parameters.
- Parameters:
- model
McmcSaemCompatibleModel Model used to compute the trajectory.
- indiv_parametersDictParamsTorch
Individual parameter dictionary.
- timepoints
torch.Tensor Timepoints at which to compute the trajectory.
- **kwargs
color: iterable of colors.save_as:str, filename to save the plot.
- model
- Parameters:
model (McmcSaemCompatibleModel)
indiv_parameters (DictParamsTorch)
timepoints (Tensor)
- Return type:
None
- plot_distribution(results, parameter, cofactor=None, **kwargs)[source]¶
Plot histogram(s) of an estimated parameter distribution.
- plot_correlation(results, parameter_1, parameter_2, cofactor=None, **kwargs)[source]¶
Plot scatter correlation between two parameters.
- plot_patients_mapped_on_mean_trajectory(model, results, *, n_std_left=2, n_std_right=4, n_pts=100)[source]¶
Plot observed patient values mapped onto the mean trajectory.
- Parameters:
- model
McmcSaemCompatibleModel Model used for computing mean and individual trajectories.
- resultsobject
Results containing data and individual parameters.
- n_std_left
int, optional How many standard deviations before the mean to plot. Default=2.
- n_std_right
int, optional How many standard deviations after the mean to plot. Default=4.
- n_pts
int, optional Number of timepoints to evaluate. Default=100.
- model
- Parameters:
model (McmcSaemCompatibleModel)
n_std_left (int)
n_std_right (int)
n_pts (int)
- Return type:
None
- classmethod plot_error(path, dataset, model, param_ind, colors=None, labels=None)[source]¶
- Parameters:
model (McmcSaemCompatibleModel)
- classmethod plot_patient_reconstructions(path, dataset, model, param_ind, *, max_patient_number=5, attribute_type=None)[source]¶
- Parameters:
path (str)
dataset (Dataset)
model (McmcSaemCompatibleModel)
param_ind (DictParamsTorch)
max_patient_number (int)