leaspy.io.logs.fit_output_manager module
- class FitOutputManager(outputs)
Bases:
object
Class used by
AbstractAlgo
(and its child classes) to display & save plots and statistics during algorithm execution.- Parameters:
- outputs
OutputsSettings
Initialize the FitOutputManager class attributes, like the logs paths, the console print periodicity and so forth.
- outputs
- Attributes:
- path_outputstr
Path of the folder containing all the outputs
- path_plotstr
Path of the subfolder of path_output containing the logs plots
- path_plot_convergence_model_parameters_1str
Path of the first plot of the convergence of the model’s parameters (in the subfolder path_plot)
- path_plot_convergence_model_parameters_2str
Path of the second plot of the convergence of the model’s parameters (in the subfolder path_plot)
- path_plot_patientsstr
Path of the subfolder of path_plot containing the plot of the reconstruction of the patients’ longitudinal trajectory by the model
- path_save_model_parameters_convergencestr
Path of the subfolder of path_output containing the progression of the model’s parameters convergence
- periodicity_plotint (default 100)
Set the frequency of the display of the plots
- periodicity_printint
Set the frequency of the display of the statistics
- periodicity_saveint
Set the frequency of the saves of the model’s parameters & the realizations
- plot_optionsdict
Contain all the additional information (for now contain only the number of displayed patients by the method plot_patient_reconstructions - which is 5 by default)
- plotter
Plotter
class object used to call visualization methods
- timefloat
Last timestamp (to display the duration between two visualization prints)
Methods
iteration
(algo, data, model, realizations)Call methods to save state of the running computation, display statistics & plots if the current iteration is a multiple of periodicity_print, periodicity_plot or periodicity_save
Plot the convergence of the model parameters (calling the Plotter)
plot_patient_reconstructions
(iteration, ...)Plot on the same graph for several patients their real longitudinal values and their reconstructions by the model.
print_algo_statistics
(algo)Print algorithm's statistics
print_model_statistics
(model)Print model's statistics
Display the duration since the last print
save_model_parameters_convergence
(iteration, ...)Save the current state of the model's parameters
save_realizations
(iteration, realizations)Save the current realizations.
- iteration(algo, data: Data, model: AbstractModel, realizations: CollectionRealization)
Call methods to save state of the running computation, display statistics & plots if the current iteration is a multiple of periodicity_print, periodicity_plot or periodicity_save
- Parameters:
- algo
AbstractAlgo
The running algorithm
- data
Data
The data used by the computation
- model
AbstractModel
The model used by the computation
- realizations
CollectionRealization
Current state of the realizations
- algo
- plot_convergence_model_parameters(model: AbstractModel)
Plot the convergence of the model parameters (calling the Plotter)
- Parameters:
- model
AbstractModel
The model used by the computation
- model
- plot_patient_reconstructions(iteration: int, data: Data, model: AbstractModel, realizations: CollectionRealization) None
Plot on the same graph for several patients their real longitudinal values and their reconstructions by the model.
- Parameters:
- iterationint
The current iteration
- data
Data
The data used by the computation
- model
AbstractModel
The model used by the computation
- realizations
CollectionRealization
Current state of the realizations
- print_algo_statistics(algo)
Print algorithm’s statistics
- Parameters:
- algo
AbstractAlgo
The running algorithm
- algo
- print_model_statistics(model: AbstractModel)
Print model’s statistics
- Parameters:
- model
AbstractModel
The model used by the computation
- model
- print_time()
Display the duration since the last print
- save_model_parameters_convergence(iteration: int, model: AbstractModel) None
Save the current state of the model’s parameters
- Parameters:
- iterationint
The current iteration
- model
AbstractModel
The model used by the computation
- save_realizations(iteration: int, realizations: CollectionRealization) None
Save the current realizations. The path is given by the attribute path_save_model_parameters_convergence.
- Parameters:
- iterationint
The current iteration
- realizations
CollectionRealization
Current state of the realizations