Skip to content

Add model.summary() and model.info() functions #469

@KaisaridiSofia

Description

@KaisaridiSofia

Add print functions to offer the users a unified idea of the leaspy model summary and information after the fit. The inspiration was drawn from lcmm and JMBayes.

from leaspy.models import LogisticModel
model = LogisticModel(name="test", source_dimension=1,
                      dimension=3, obs_models=gaussian-diagonal')
model.fit(leaspy_dataset, "mcmc_saem", n_iter=1000, 
          progress_bar=True, save_periodicity=1, 
          plot_periodicity= None, path='my_path', 
          overwrite_logs_folder=True)

model.info()               
model.summary()

The function model.info() will print the information we already know about the model and the model.summary() the information provided by the fit. More specifically :

model.info()

Dataset info

- number of subjects
- number of scores
- number of observations
    - total, per subject: median, min, max, IQR
- number of missing data
    - total, per score
- ++ for other models (joint: number of events)

Statistical model

- type of model (logistic, linear, joint, mixture)
- type of observation model (gaussian-daigonal, gaussian-scalar, weibull)
- number of parameters
- number of sources
- ++ for other models (mixture: number of clusters)
- the latents' parameter distributions (normal, or mixture of normals)
- the values of the hyperparameters

MCMC summary

- type (MCMC-SAEM)
- iterations
- burn-in, burn-out
- time

model.summary()

Goodness-of-fit statistics

- maximum log-likelihood
- BIC
- AIC
- ++ for other models (mixture : ICL) 

Maximum Likelihood Estimates

- Model parameters (Fixed effects)
    - Population parameters: log_g_mean, log_v0_mean, betas
        - ++ mixture: probs
        - ++ joint: 
        - maybe a note to use model.parameters.transform
    - Individual parameters: tau_mean, tau_std, xi_std
        - ++ mixture: xi_mean, sources_mean
        - ++ joint: 
    - Residual standard error (noise): epsilons

In the future we should find a way to include the uncertainty of the parameters and the convergence metrics. For now they are not implemented in Leaspy but they are results that are often reported in these types of models. Note for the future :

In the model parameters

  • Uncertainty of parameters
    • Fisher Information Matrix or credibility intervals

Add a convergence block when we decide on how to assess the convergence

  • example in lcmm (although another algorithm is used for the estimation)
    - convergene criteria satisfied
    - numerical results of convergence critera

Metadata

Metadata

Labels

needs: implementationdesign is discussed and ready, we can start a PRon: codeimprovements, additions and fixes on the codebasepriority: topshould be ready by the new release

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions