pyemma.thermo.WHAM¶
-
class
pyemma.thermo.
WHAM
(bias_energies_full, stride=1, maxiter=10000, maxerr=1e-15, dt_traj='1 step', save_convergence_info=0)¶ Weighted Histogram Analysis Method
Parameters: - bias_energies_full (ndarray(K, n)) – bias_energies_full[j,i] is the bias energy for each discrete state i at thermodynamic state j.
- maxiter (int, optional, default=10000) – The maximum number of self-consistent iterations before the estimator exits unsuccessfully.
- maxerr (float, optional, default=1E-15) – Convergence criterion based on the maximal free energy change in a self-consistent iteration step.
- dt_traj (str, optional, default='1 step') –
Description of the physical time corresponding to the lag. May be used by analysis algorithms such as plotting tools to pretty-print the axes. By default ‘1 step’, i.e. there is no physical time unit. Specify by a number, whitespace and unit. Permitted units are (* is an arbitrary string):
‘fs’, ‘femtosecond*’‘ps’, ‘picosecond*’‘ns’, ‘nanosecond*’‘us’, ‘microsecond*’‘ms’, ‘millisecond*’‘s’, ‘second*’ - save_convergence_info (int, optional, default=0) – Every save_convergence_info iteration steps, store the actual increment and the actual loglikelihood; 0 means no storage.
- TODO (stride) –
Example
>>> from pyemma.thermo import WHAM >>> import numpy as np >>> B = np.array([[0, 0],[0.5, 1.0]]) >>> wham = WHAM(B) >>> traj1 = np.array([[0,0,0,0,0,0,0,0,0,0],[0,0,0,0,1,1,1,0,0,0]]).T >>> traj2 = np.array([[1,1,1,1,1,1,1,1,1,1],[0,1,0,1,0,1,1,0,0,1]]).T >>> wham = wham.estimate([traj1, traj2]) >>> wham.log_likelihood() -6.6... >>> wham.state_counts array([[7, 3], [5, 5]]) >>> wham.stationary_distribution array([ 0.5..., 0.4...]) >>> wham.meval('stationary_distribution') [array([ 0.5..., 0.4...]), array([ 0.6..., 0.3...])]
-
__init__
(bias_energies_full, stride=1, maxiter=10000, maxerr=1e-15, dt_traj='1 step', save_convergence_info=0)¶
Methods
__init__
(bias_energies_full[, stride, ...])estimate
(X, **params)Estimates the model given the data X expectation
(a)Equilibrium expectation value of a given observable. fit
(X)Estimates parameters - for compatibility with sklearn. get_model_params
([deep])Get parameters for this model. get_params
([deep])Get parameters for this estimator. log_likelihood
()meval
(f, *args, **kw)Evaluates the given function call for all models set_model_params
([models, f_therm, pi, f, label])set_params
(**params)Set the parameters of this estimator. update_model_params
(**params)Update given model parameter if they are set to specific values Attributes
free_energies
The free energies of discrete states logger
The logger for this class instance model
The model estimated by this Estimator name
The name of this instance nstates
Number of active states on which all computations and estimations are done stationary_distribution
The stationary distribution -
estimate
(X, **params)¶ Estimates the model given the data X
Parameters: - X (object) – A reference to the data from which the model will be estimated
- params (dict) – New estimation parameter values. The parameters must that have been announced in the __init__ method of this estimator. The present settings will overwrite the settings of parameters given in the __init__ method, i.e. the parameter values after this call will be those that have been used for this estimation. Use this option if only one or a few parameters change with respect to the __init__ settings for this run, and if you don’t need to remember the original settings of these changed parameters.
Returns: estimator – The estimated estimator with the model being available.
Return type: object
-
expectation
(a)¶ Equilibrium expectation value of a given observable. :param a: Observable vector :type a: (M,) ndarray
Returns: val – Equilibrium expectation value of the given observable Return type: float Notes
The equilibrium expectation value of an observable a is defined as follows
\[\mathbb{E}_{\mu}[a] = \sum_i \mu_i a_i\]\(\mu=(\mu_i)\) is the stationary vector of the transition matrix \(T\).
-
fit
(X)¶ Estimates parameters - for compatibility with sklearn.
Parameters: X (object) – A reference to the data from which the model will be estimated Returns: estimator – The estimator (self) with estimated model. Return type: object
-
free_energies
¶ The free energies of discrete states
-
get_model_params
(deep=True)¶ Get parameters for this model.
Parameters: deep (boolean, optional) – If True, will return the parameters for this estimator and contained subobjects that are estimators. Returns: params – Parameter names mapped to their values. Return type: mapping of string to any
-
get_params
(deep=True)¶ Get parameters for this estimator.
Parameters: deep (boolean, optional) – If True, will return the parameters for this estimator and contained subobjects that are estimators. Returns: params – Parameter names mapped to their values. Return type: mapping of string to any
-
logger
¶ The logger for this class instance
-
meval
(f, *args, **kw)¶ Evaluates the given function call for all models Returns the results of the calls in a list
-
model
¶ The model estimated by this Estimator
-
name
¶ The name of this instance
-
nstates
¶ Number of active states on which all computations and estimations are done
-
set_params
(**params)¶ Set the parameters of this estimator. The method works on simple estimators as well as on nested objects (such as pipelines). The former have parameters of the form
<component>__<parameter>
so that it’s possible to update each component of a nested object. :returns: :rtype: self
-
stationary_distribution
¶ The stationary distribution
-
update_model_params
(**params)¶ Update given model parameter if they are set to specific values