leaspy.io.logs.visualization.plotter ==================================== .. py:module:: leaspy.io.logs.visualization.plotter Classes ------- .. autoapisummary:: leaspy.io.logs.visualization.plotter.Plotter Module Contents --------------- .. py:class:: Plotter(output_path = None) Class defining some plotting tools. :Parameters: **output_path** : :obj:`str`, (optional) Folder where plots will be saved. If None, default to current working directory. .. !! processed by numpydoc !! .. py:attribute:: output_path :value: None .. py:method:: plt_show() 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. .. !! processed by numpydoc !! .. py:method:: plot_mean_trajectory(model, *, n_pts = 100, n_std_left = 3, n_std_right = 6, **kwargs) Plot the mean model trajectory. :Parameters: **model** : :class:`McmcSaemCompatibleModel` or iterable of such Model(s) to compute the mean trajectory for. **n_pts** : :obj:`int`, optional Number of timepoints to evaluate between the start and end. Default=100. **n_std_left** : :obj:`int`, optional How many standard deviations before the mean to plot. Default=3. **n_std_right** : :obj:`int`, optional How many standard deviations after the mean to plot. Default=6. **\*\*kwargs** - ``color`` : iterable of colors - ``title`` : :obj:`str`, plot title - ``save_as`` : :obj:`str`, filename to save the plot :Raises: LeaspyInputError If the model(s) is/are not initialized. .. !! processed by numpydoc !! .. py:method:: plot_mean_validity(model, results, **kwargs) Plot histogram of reparametrized times for all individuals. :Parameters: **model** : :class:`McmcSaemCompatibleModel` Fitted model providing `tau_mean` and `tau_std`. **results** : object Results containing `data` and `individual_parameters` with keys ``xi`` and ``tau``. **\*\*kwargs** - ``save_as`` : :obj:`str`, filename to save the plot. .. !! processed by numpydoc !! .. py:method:: plot_patient_trajectory(model, results, indices, **kwargs) Plot observed data and reconstructed trajectory for one or more patients. :Parameters: **model** : :class:`McmcSaemCompatibleModel` Model to use for computing individual trajectories. **results** : object Results containing data and individual parameters. **indices** : :obj:`str` or list of :obj:`int` Patient index/indices to plot. **\*\*kwargs** - ``ax`` : matplotlib axis to plot on. - ``color`` : iterable of colors. - ``title`` : :obj:`str`, plot title. - ``save_as`` : :obj:`str`, filename to save the plot. .. !! processed by numpydoc !! .. py:method:: plot_from_individual_parameters(model, indiv_parameters, timepoints, **kwargs) Plot a trajectory computed from given individual parameters. :Parameters: **model** : :class:`McmcSaemCompatibleModel` Model used to compute the trajectory. **indiv_parameters** : DictParamsTorch Individual parameter dictionary. **timepoints** : :obj:`torch.Tensor` Timepoints at which to compute the trajectory. **\*\*kwargs** - ``color`` : iterable of colors. - ``save_as`` : :obj:`str`, filename to save the plot. .. !! processed by numpydoc !! .. py:method:: plot_distribution(results, parameter, cofactor=None, **kwargs) Plot histogram(s) of an estimated parameter distribution. :Parameters: **results** : object Results containing a `get_parameter_distribution` method. **parameter** : :obj:`str` Parameter name to plot. **cofactor** : optional Grouping variable; if given, plot separate histograms per group. **\*\*kwargs** - ``save_as`` : :obj:`str`, filename to save the plot. .. !! processed by numpydoc !! .. py:method:: plot_correlation(results, parameter_1, parameter_2, cofactor=None, **kwargs) Plot scatter correlation between two parameters. :Parameters: **results** : object Results containing a `get_parameter_distribution` method. **parameter_1** : :obj:`str` First parameter name. **parameter_2** : :obj:`str` Second parameter name. **cofactor** : optional Grouping variable; if given, scatter different colors per group. **\*\*kwargs** - ``save_as`` : :obj:`str`, filename to save the plot. .. !! processed by numpydoc !! .. py:method:: plot_patients_mapped_on_mean_trajectory(model, results, *, n_std_left = 2, n_std_right = 4, n_pts = 100) Plot observed patient values mapped onto the mean trajectory. :Parameters: **model** : :class:`McmcSaemCompatibleModel` Model used for computing mean and individual trajectories. **results** : object Results containing data and individual parameters. **n_std_left** : :obj:`int`, optional How many standard deviations before the mean to plot. Default=2. **n_std_right** : :obj:`int`, optional How many standard deviations after the mean to plot. Default=4. **n_pts** : :obj:`int`, optional Number of timepoints to evaluate. Default=100. .. !! processed by numpydoc !! .. py:method:: plot_error(path, dataset, model, param_ind, colors=None, labels=None) :classmethod: .. py:method:: plot_patient_reconstructions(path, dataset, model, param_ind, *, max_patient_number = 5, attribute_type=None) :classmethod: .. py:method:: plot_param_ind(path, param_ind) :staticmethod: .. py:method:: plot_convergence_model_parameters(path, path_saveplot_1, path_saveplot_2, model) :staticmethod: