Skip to content

Commit

Permalink
Address warnings + remove warning suppression (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
twallema authored May 12, 2024
1 parent e344a09 commit 035d025
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
6 changes: 1 addition & 5 deletions tutorials/SIR/workflow_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@
from pySODM.optimization.mcmc import perturbate_theta, run_EnsembleSampler, emcee_sampler_to_dictionary
from pySODM.optimization.objective_functions import log_posterior_probability, ll_negative_binomial

# Suppress warnings
import warnings
warnings.filterwarnings("ignore")

######################################################
## Generate a synthetic dataset with overdispersion ##
######################################################
Expand Down Expand Up @@ -107,7 +103,7 @@ def integrate(t, S, I, R, beta, gamma):
# Calibated parameters and bounds
pars = ['beta',]
labels = ['$\\beta$',]
bounds = [(1e-6,1),]
bounds = [(0,10),]
# Setup objective function (no priors --> uniform priors based on bounds)
objective_function = log_posterior_probability(model, pars, bounds, data, states, log_likelihood_fnc, log_likelihood_fnc_args, labels=labels)
# Extract start- and enddate
Expand Down
4 changes: 0 additions & 4 deletions tutorials/SIR_SI/calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
from pySODM.optimization.mcmc import perturbate_theta, run_EnsembleSampler, emcee_sampler_to_dictionary
from pySODM.optimization.objective_functions import log_posterior_probability, ll_negative_binomial, ll_poisson

# Suppress warnings
import warnings
warnings.filterwarnings("ignore")

##################
## Define model ##
##################
Expand Down
7 changes: 2 additions & 5 deletions tutorials/influenza_1718/calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@
from pySODM.optimization.objective_functions import log_posterior_probability, ll_negative_binomial
# pySODM dependecies
import corner
# Suppress warnings
import warnings
warnings.filterwarnings("ignore")

##############
## Settings ##
Expand All @@ -52,10 +49,10 @@
###############

# Load case data
data = pd.read_csv(os.path.join(os.path.dirname(__file__),'data/interim/data_influenza_1718_format.csv'), index_col=[0,1], parse_dates=True)
data = pd.read_csv(os.path.join(os.path.dirname(__file__),'data/interim/data_influenza_1718_format.csv'), index_col=[0,1], parse_dates=True, date_format='%Y-%m-%d')
data = data.squeeze()
# Load case data per 100K
data_100K = pd.read_csv(os.path.join(os.path.dirname(__file__),'data/interim/data_influenza_1718_format_100K.csv'), index_col=[0,1], parse_dates=True)
data_100K = pd.read_csv(os.path.join(os.path.dirname(__file__),'data/interim/data_influenza_1718_format_100K.csv'), index_col=[0,1], parse_dates=True, date_format='%Y-%m-%d')
data_100K = data_100K.squeeze()
# Re-insert pd.IntervalIndex (pd.IntervalIndex is always loaded as a string..)
age_groups = pd.IntervalIndex.from_tuples([(0,5),(5,15),(15,65),(65,120)], closed='left')
Expand Down

0 comments on commit 035d025

Please sign in to comment.