pymcmcstat.structures package¶
pymcmcstat.structures.ParameterSet module¶
Created on Thu Jan 18 10:15:37 2018
@author: prmiles
pymcmcstat.structures.ResultsStructure module¶
Created on Wed Jan 17 09:18:19 2018
@author: prmiles
-
class
pymcmcstat.structures.ResultsStructure.
ResultsStructure
[source]¶ Bases:
object
Results from MCMC simulation.
Description: Class used to organize results of MCMC simulation.
- Attributes:
-
add_basic
(nsimu, covariance, parameters, rejected, simutime, theta)[source]¶ Add basic results from MCMC simulation to structure.
- Args:
- nsimu (
int
): Number of MCMC simulations. - model (
ModelSettings
): MCMC model settings. - covariance (
CovarianceProcedures
): Covariance variables. - parameters (
ModelParameters
): Model parameters. - rejected (
dict
): Dictionary of rejection stats. - simutime (
float
): Simulation run time in seconds. - theta (
ndarray
): Last sampled values.
- nsimu (
-
add_chain
(chain=None)[source]¶ Add chain to results structure.
- Args:
- chain (
ndarray
): Model parameter sampling chain.
- chain (
-
add_dram
(drscale, RDR, total_rejected, drsettings)[source]¶ Add results specific to performing DR algorithm.
- Args:
- drscale (
ndarray
): Reduced scale for sampling in DR algorithm. Default is [5,4,3]. - RDR (
ndarray
): Cholesky decomposition of covariance matrix based on DR. - total_rejected (
int
): Number of rejected samples. - drsettings (
DelayedRejection
): Need access to counters within DR class.
- drscale (
-
add_model
(model=None)[source]¶ Saves subset of features of the model settings in a nested dictionary.
- Args:
- model (
ModelSettings
): MCMC model settings.
- model (
-
add_options
(options=None)[source]¶ Saves subset of features of the simulation options in a nested dictionary.
- Args:
- options (
SimulationOptions
): MCMC simulation options.
- options (
-
add_prior
(mu, sigma, priortype)[source]¶ Add results specific to prior function.
- Args:
Note
This feature is not currently implemented.
-
add_random_number_sequence
(rndseq)[source]¶ Add random number sequence to results structure.
- Args:
- rndseq (
ndarray
): Sequence of sampled random numbers.
- rndseq (
Note
This feature is not currently implemented.
-
add_s2chain
(s2chain=None)[source]¶ Add observiation error chain to results structure.
- Args:
- s2chain (
ndarray
): Sampling chain of observation errors.
- s2chain (
-
add_sschain
(sschain=None)[source]¶ Add sum-of-squares chain to results structure.
- Args:
- sschain (
ndarray
): Calculated sum-of-squares error for each parameter chains set.
- sschain (
-
add_time_stats
(mtime, drtime, adtime)[source]¶ Add time spend using each sampling algorithm.
- Args:
Note
This feature is not currently implemented.
-
add_updatesigma
(updatesigma, sigma2, S20, N0)[source]¶ Add information to results structure related to observation error.
- Args:
If
updatesigma is True
, thenresults['sigma2'] = np.nan results['S20'] = S20 results['N0'] = N0
Otherwise
results['sigma2'] = sigma2 results['S20'] = np.nan results['N0'] = np.nan
-
classmethod
determine_filename
(options)[source]¶ Determine results filename.
If not specified by results_filename in the simulation options, then a default naming format is generated using the date string associated with the initialization of the simulation.
- Args:
- options (
SimulationOptions
): MCMC simulation options.
- options (
- Returns:
- filename (
str
): Filename string.
- filename (
-
export_lightly
(results)[source]¶ Export minimal simulation results to a json file.
This will save the key terms in the results dict, excluding arrays. Ideally, this is used in conjunction with one of the chain saving methods. The goal is to provide a results dict to simplify post- processing and reduces storage overhead.
- Args:
- results (
ResultsStructure
): Dictionary of MCMC simulation results/settings.
- results (
-
export_simulation_results_to_json_file
(results)[source]¶ Export simulation results to a json file.
- Args:
- results (
ResultsStructure
): Dictionary of MCMC simulation results/settings.
- results (
-
pymcmcstat.structures.ResultsStructure.
lighten_results
(results)[source]¶ Saves subset of features of the simulation options in a nested dictionary.
- Args:
- options (
SimulationOptions
): MCMC simulation options.
- options (