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:
outputsOutputsSettings

Initialize the FitOutputManager class attributes, like the logs paths, the console print periodicity and so forth.

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)

plotterPlotter

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_convergence_model_parameters(model)

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

print_time()

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:
algoAbstractAlgo

The running algorithm

dataData

The data used by the computation

modelAbstractModel

The model used by the computation

realizationsCollectionRealization

Current state of the realizations

plot_convergence_model_parameters(model: AbstractModel)

Plot the convergence of the model parameters (calling the Plotter)

Parameters:
modelAbstractModel

The model used by the computation

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

dataData

The data used by the computation

modelAbstractModel

The model used by the computation

realizationsCollectionRealization

Current state of the realizations

print_algo_statistics(algo)

Print algorithm’s statistics

Parameters:
algoAbstractAlgo

The running algorithm

print_model_statistics(model: AbstractModel)

Print model’s statistics

Parameters:
modelAbstractModel

The model used by the computation

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

modelAbstractModel

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

realizationsCollectionRealization

Current state of the realizations