A detailed description of mhn’s subpackages, submodules and functions#
This part of the documentation contains descriptions of all functions included in the mhn package.
Directly callable functions and constants#
- mhn.set_seed(seed: int)#
Set the random seed for reproducibility. Internally, this sets the seed for the numpy random generator.
- Parameters:
seed (int) – The seed value to use for random number generators.
- mhn.cuda_available() Literal[CUDA_AVAILABLE, CUDA_NOT_AVAILABLE, CUDA_NOT_FUNCTIONAL]#
Call this function if you want to know if the mhn package is able to use CUDA functions on your device.
- mhn.CUDA_AVAILABLE#
Constant returned by
cuda_available()if CUDA functions are available and working correctly.
- mhn.CUDA_NOT_AVAILABLE#
Constant returned by
cuda_available()if the CUDA compiler (nvcc) was not present during installation. If this was not expected, ensure that the CUDA toolkit is properly installed and accessible.
- mhn.CUDA_NOT_FUNCTIONAL#
Constant returned by
cuda_available()if the CUDA compiler (nvcc) is available, but CUDA functions are not working as expected. In this case, check your CUDA drivers and installation for potential issues.
The full_state_space subpackage#
This part of the mhn package contains functions to compute and work with MHNs on the full state-space.
The structure of this part of the package is very similar to the original R implementation by Schill et al. (2019):
- Likelihood:
contains functions to compute the log-likelihood score and its gradient without state-space restriction as well as functions for matrix-vector multiplications with the transition rate matrix and [I-Q]^(-1)
- ModelConstruction:
contains functions to generate random MHNs, build their transition rate matrix Q, the diagonal of Q, and to generate and independence model for a given distribution
- RegularizedOptimization:
contains functions to learn an cMHN for a given data distribution, implements the L1 regularization
- UtilityFunctions:
contains functions useful for preprocessing data to be used as training data
- PerformanceCriticalCode:
contains functions that dominate the runtime of score and gradient computations and must therefore be implemented efficiently
- fisher:
contains functions to compute the Fisher information matrix for MHN
The training subpackage#
This part of the package contains functions that are needed for model training.
The optimizers submodule#
This submodule contains Optimizer classes to learn an MHN from mutation data.
The model submodule#
This submodule contains classes to represent Mutual Hazard Networks.
The utilities submodule#
This module contains some utility functions for working with MHNs.
The mcmc subpackage#
This part of the mhn package contains functions for the posterior sampling of MHNs with Markov Chain Monte Carlo.
- kernels:
contains the Random-Walk Metropolis, Metropolis-Adjusted Langevin Algorithm (MALA) and simplified manifold MALA kernels and a base kernel base class. Those are responsible for the actual steps of MCMC.
- mcmc:
contains the MCMC class that uses the kernels to create MCMC chains.