def __init__(
        self,
        trainer: TrainerABC,
        state_repository: TrainStateRepository,
        keep_top_n_checkpoints: int,
    ):
        """
        Sampling callback that collects samples from the MCMC chain.

        Parameters
        ----------
        trainer: TrainerABC
            An instance of the trainer class.
        state_repository: TrainStateRepository
            An instance of the state repository.
        keep_top_n_checkpoints: int
            Number of past checkpoint files to keep.
        """
        self._trainer = trainer
        self._state_repository = state_repository
        self._keep_top_n_checkpoints = keep_top_n_checkpoints

        self._current_step = 0
        self._samples_count = 0

        Sampling callback that collects samples from the MCMC chain.

        Parameters
        ----------
        trainer: TrainerABC
            An instance of the trainer class.
        state_repository: TrainStateRepository
            An instance of the state repository.
        keep_top_n_checkpoints: int
            Number of past checkpoint files to keep.
        
fortuna/prob_model/posterior/sgmcmc/sgmcmc_sampling_callback.py