Package SloppyCell :: Module Ensembles
[hide private]

Module Ensembles

source code

Classes [hide private]
  KeyedList
Functions [hide private]
 
autocorrelation(series)
Return the normalized autocorrelation of a series using the FFT.
source code
 
ensemble(m, params, hess=None, steps=scipy.inf, max_run_hours=scipy.inf, temperature=1.0, step_scale=1.0, sing_val_cutoff=0, seeds=None, recalc_hess_alg=False, recalc_func=None, save_hours=scipy.inf, skip_elems=0, save_to=None)
Generate a Bayesian ensemble of parameter sets consistent with the data in the model.
source code
 
ensemble_log_params(m, params, hess=None, steps=scipy.inf, max_run_hours=scipy.inf, temperature=1.0, step_scale=1.0, sing_val_cutoff=0, seeds=None, recalc_hess_alg=False, recalc_func=None, save_hours=scipy.inf, save_to=None, skip_elems=0, log_params=True)
Generate a Bayesian ensemble of parameter sets consistent with the data in the model.
source code
 
_save_ens(ens, ens_Fs, ratio, save_to, attempt_exceptions, steps_attempted) source code
 
_accept_move(delta_F, temperature)
Basic Metropolis accept/reject step.
source code
 
_accept_move_recalc_alg(curr_F, curr_samp_mat, next_F, next_samp_mat, step, T)
Accept/reject when each the sampling matrix is recalculated each step.
source code
 
_sampling_matrix(hessian, cutoff=0, temperature=1, step_scale=1) source code
 
_trial_move(sampling_mat) source code
 
_quadratic_cost(trialMove, hessian)
The cost from the quadratic approximation of a trialMove, given the hessian.
source code
 
traj_ensemble_stats(traj_set)
Return the mean and standard deviation trajectory objects for the given input list of trajectories.
source code
 
few_ensemble_trajs(net, times, elements) source code
 
ensemble_trajs(net, times, ensemble)
Return a list of trajectories evaluated at times for all parameter sets in ensemble.
source code
 
net_ensemble_trajs(net, times, ensemble) source code
 
traj_ensemble_quantiles(traj_set, quantiles=(0.025,0.5,0.975))
Return a list of trajectories, each one corresponding the a given passed-in quantile.
source code
 
PCA_eig_log_params(ens)
Return the Principle Component Analysis eigenvalues and eigenvectors (in log parameters) of an ensemble.
source code
 
PCA_eig(ens)
Return the Principle Component Analysis eigenvalues and eigenvectors of an ensemble.
source code
Variables [hide private]
  logger = logging.getLogger('Ensembles')

Imports: logging, copy, shutil, sys, time, scipy, KeyedList_mod, Utility, HAVE_PYPAR, my_rank, my_host, num_procs, pypar


Function Details [hide private]

ensemble(m, params, hess=None, steps=scipy.inf, max_run_hours=scipy.inf, temperature=1.0, step_scale=1.0, sing_val_cutoff=0, seeds=None, recalc_hess_alg=False, recalc_func=None, save_hours=scipy.inf, skip_elems=0, save_to=None)

source code 

Generate a Bayesian ensemble of parameter sets consistent with the data in
the model. The sampling is done in terms of the bare parameters.

Inputs:
 (All not listed here are identical to those of ensemble_log_params.)
 recalc_func --- Function used to calculate the hessian matrix. It should
                 take only a parameters argument and return the matrix.
                 If this is None, default is to use m.GetJandJtJ.

ensemble_log_params(m, params, hess=None, steps=scipy.inf, max_run_hours=scipy.inf, temperature=1.0, step_scale=1.0, sing_val_cutoff=0, seeds=None, recalc_hess_alg=False, recalc_func=None, save_hours=scipy.inf, save_to=None, skip_elems=0, log_params=True)

source code 

Generate a Bayesian ensemble of parameter sets consistent with the data in
the model. The sampling is done in terms of the logarithm of the parameters.

Inputs:
 m -- Model to generate the ensemble for
 params -- Initial parameter KeyedList to start from 
 hess -- Hessian of the model
 steps -- Maximum number of Monte Carlo steps to attempt
 max_run_hours -- Maximum number of hours to run
 temperature -- Temperature of the ensemble
 step_scale -- Additional scale applied to each step taken. step_scale < 1
               results in steps shorter than those dictated by the quadratic
               approximation and may be useful if acceptance is low.
 sing_val_cutoff -- Truncate the quadratic approximation at eigenvalues
                    smaller than this fraction of the largest.
 seeds -- A tuple of two integers to seed the random number generator
 recalc_hess_alg --- If True, the Monte-Carlo is done by recalculating the
                     hessian matrix every timestep. This signficantly
                     increases the computation requirements for each step,
                     but it may be worth it if it improves convergence.
 recalc_func --- Function used to calculate the hessian matrix. It should
                 take only a log parameters argument and return the matrix.
                 If this is None, default is to use 
                 m.GetJandJtJInLogParameteters
 save_hours --- If save_to is not None, the ensemble will be saved to
                   that file every 'save_hours' hours.
 save_to --- Filename to save ensemble to.
 skip_elems --- If non-zero, skip_elems are skipped between each included 
                step in the returned ensemble. For example, skip_elems=1
                will return every other member. Using this option can
                reduce memory consumption.

Outputs:
 ens, ens_fes, ratio
 ens -- List of KeyedList parameter sets in the ensemble
 ens_fes -- List of free energies for each parameter set
 ratio -- Fraction of attempted moves that were accepted

The sampling is done by Markov Chain Monte Carlo, with a Metropolis-Hasting
update scheme. The canidate-generating density is a gaussian centered on the
current point, with axes determined by the hessian. For a useful 
introduction see:
 Chib and Greenberg. "Understanding the Metropolis-Hastings Algorithm" 
 _The_American_Statistician_ 49(4), 327-335

_quadratic_cost(trialMove, hessian)

source code 

The cost from the quadratic approximation of a trialMove, given the hessian.

(Note: the hessian here is assumed to be the second derivative matrix of the
 cost, without an additional factor of 1/2.)

traj_ensemble_stats(traj_set)

source code 

Return the mean and standard deviation trajectory objects for the given 
input list of trajectories. (All must be evaluated at the same points.)

PCA_eig_log_params(ens)

source code 

Return the Principle Component Analysis eigenvalues and eigenvectors (in 
 log parameters) of an ensemble. (This function takes the logs for you.)