leaspy.algo.fit.fit_output_manager#

Classes#

FitOutputManager

Class used by AbstractAlgo (and its child classes) to display & save plots and statistics during algorithm execution.

Module Contents#

class FitOutputManager(outputs)#

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_parametersstr

Path of the first 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

nb_of_patients_to_plotint

Number of patients for whom the reconstructions will be plotted.

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

periodicity_plot_patientsint

Set the frequency of the saves of the patients’ reconstructions

plot_sourcewisebool

If True, plots will be generated for each source separately.

periodicity_print#
periodicity_save#
periodicity_plot#
nb_of_patients_to_plot#
periodicity_plot_patients#
plot_sourcewise#
time#
iteration(algo, model, data)#

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

A fitting algorithm.

modelMcmcSaemCompatibleModel

The model used by the computation.

dataDataset

The data used by the computation

Parameters:
Return type:

None

print_time()#

Prints the duration since the last periodic point.

print_model_statistics(model)#

Prints model’s statistics.

Parameters:
modelMcmcSaemCompatibleModel

The model used by the computation

Parameters:

model (McmcSaemCompatibleModel)

print_algo_statistics(algo)#

Prints algorithm’s statistics

Parameters:
algoFitAlgo

A fitting algorithm.

Parameters:

algo (FitAlgorithm)

save_model_parameters_convergence(iteration, model)#

Saves the current state of the model’s parameters

Parameters:
iterationint

The current iteration.

modelMcmcSaemCompatibleModel

The model used by the computation

Parameters:
Return type:

None

save_plot_convergence_model_parameters(model)#

Saves figures of the model parameters’ convergence in multiple pages of a PDF.

Parameters:
modelMcmcSaemCompatibleModel

The model used by the computation

Parameters:

model (McmcSaemCompatibleModel)

save_plot_patient_reconstructions(iteration, model, data)#

Saves figures of real longitudinal values and their reconstructions computed by the model for maximum 5 patients during each iteration.

Parameters:
iterationint

The current iteration

modelMcmcSaemCompatibleModel

The model used by the computation

dataDataset

The dataset used by the computation

Parameters:
Return type:

None