Likelihoodsο
This module computes likelihood for any multivae model.
from multivae.metrics import LikelihoodsEvaluator, LikelihoodsEvaluatorConfig
eval_config = LikelihoodsEvaluatorConfig(batch_size=128,
wandb_path='your_wandb_path',
num_samples=1000)
eval_module = LikelihoodsEvaluator(
model = your_model,
test_dataset=test_set,
output='./metrics',# where to save metrics
eval_config=eval_config
)
# Compute joint negative log likelihood
eval_module.eval()
eval_module.finish() # finishes wandb run
- class multivae.metrics.LikelihoodsEvaluatorConfig(batch_size=512, wandb_path=None, num_samples=1000, batch_size_k=100, unified_implementation=True)[source]ο
Config class for the evaluation of the coherences module.
- Parameters:
batch_size (int) β The batch size to use in the evaluation. Default to 512
wandb_path (str) β The user can provide the path of the wandb run with a format βentity/projet_name/run_idβ where the metrics should be logged. See Where to find the WandB path for a trained model ? for more information. If None is provided, the metrics are not logged on wandb. Default to None.
num_samples (int) β How many samples to use for likelihoods estimates. Default to 1000.
batch_size_k (int) β How to batch the K samples for likelihoods estimates. Default to 100.
unified_implementation (bool) β When the paper implementation of the likelihood differ from the unified implementation, specify which to use. Default to True.
- class multivae.metrics.LikelihoodsEvaluator(model, test_dataset, output=None, eval_config=LikelihoodsEvaluatorConfig(name='LikelihoodsEvaluatorConfig', batch_size=512, wandb_path=None, num_samples=1000, batch_size_k=100, unified_implementation=True))[source]ο
Class for computing likelihood metrics.
- Parameters:
model (BaseMultiVAE) β The model to evaluate.
test_dataset (MultimodalBaseDataset) β The dataset to use for computing the metrics.
output (str) β The folder path to save metrics. The metrics will be saved in a metrics.txt file.
eval_config (EvaluatorConfig) β The configuration class to specify parameters for the evaluation.