PyMC
PyMC is a Python package for Bayesian statistical modeling and probabilistic machine learning which focuses on advanced Markov chain Monte Carlo and variational fitting algorithms.
Slurm Script
#!/bin/bash
#SBATCH -J pym3_codejob # Job name
#SBATCH -o pym3_output.%j.out # Name of stdout output file (%j expands to jobId)
#SBATCH -p CUIQue # Queue name
#SBATCH -N 1 # Total number of nodes requested
#SBATCH -n 16 # Total number of mpi tasks requested
module load python/3.8.12 py-numpy/1.22.4 py-pymc3/3.8 py-arviz/0.6.1
python3.8 pym3example.py
pym3example.py Code
import arviz as az import pandas as pd import matplotlib.pyplot as plt import numpy as np ##%config InlineBackend.figure_format = 'retina' # Initialize random number generator RANDOM_SEED = 8927 rng = np.random.default_rng(RANDOM_SEED) az.style.use("arviz-darkgrid") # True parameter values alpha, sigma = 1, 1 beta = [1, 2.5] # Size of dataset size = 100 # Predictor variable X1 = np.random.randn(size) X2 = np.random.randn(size) * 0.2 # Simulate outcome variable Y = alpha + beta[0] * X1 + beta[1] * X2 + rng.normal(size=size) * sigma print (Y)
Submit the job to the scheduler as
sbatch mypym3.slurm
For managing your “job” , refer to this guide.
For more on Pymc framework,, refer to their official documentation
https://www.pymc.io/projects/docs/en/stable/learn.html