pyemma.coordinates.transform.VAMPChapmanKolmogorovValidator¶
-
class
pyemma.coordinates.transform.
VAMPChapmanKolmogorovValidator
(test_model, test_estimator, observables, statistics, observables_mean_free, statistics_mean_free, mlags=10, n_jobs=None, show_progress=True)¶ -
__init__
(test_model, test_estimator, observables, statistics, observables_mean_free, statistics_mean_free, mlags=10, n_jobs=None, show_progress=True)¶ Note
It is recommended that you create this object by calling the cktest method of a VAMP object created with
vamp
.Parameters: - test_model (Model) – Model with the smallest lag time. Is used to make predictions for larger lag times.
- test_estimator (Estimator) – Parametrized Estimator that has produced the model. Is used as a prototype for estimating models at higher lag times.
- observables (np.ndarray((input_dimension, n_observables))) – Coefficients that express one or multiple observables in the basis of the input features.
- statistics (np.ndarray((input_dimension, n_statistics))) – Coefficients that express one or multiple statistics in the basis of the input features.
- observables_mean_free (bool, default=False) – If true, coefficients in observables refer to the input features with feature means removed. If false, coefficients in observables refer to the unmodified input features.
- statistics_mean_free (bool, default=False) – If true, coefficients in
statistics
refer to the input features with feature means removed. If false, coefficients instatistics
refer to the unmodified input features. - mlags (int or int-array, default=10) – multiples of lag times for testing the Model, e.g. range(10). A single int will trigger a range, i.e. mlags=10 maps to mlags=range(10). Note that you need to be able to do a model prediction for each of these lag time multiples, e.g. the value 0 only make sense if model.expectation(lag_multiple=0) will work.
- n_jobs (int, default=None) – how many jobs to use during calculation
- show_progress (bool, default=True) – Show progressbars for calculation?
Notes
The object can be plotted with
plot_cktest
with the option y01=False.
Methods
__init__
(test_model, test_estimator, …[, …])estimate
(X, **params)Estimates the model given the data X fit
(X[, y])Estimates parameters - for compatibility with sklearn. get_params
([deep])Get parameters for this estimator. load
(file_name[, model_name])Loads a previously saved PyEMMA object from disk. save
(file_name[, model_name, overwrite, …])saves the current state of this object to given file and name. set_params
(**params)Set the parameters of this estimator. Attributes
estimates
Returns estimates at different lagtimes estimates_conf
Returns the confidence intervals of the estimates at different lagtimes (if available). lagtimes
logger
The logger for this class instance model
The model estimated by this Estimator n_jobs
Returns number of jobs/threads to use during assignment of data. name
The name of this instance predictions
Returns tested model predictions at different lagtimes predictions_conf
Returns the confidence intervals of the estimates at different lagtimes (if available) show_progress
whether to show the progress of heavy calculations on this object. statistics
-
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
-
estimates
¶ Returns estimates at different lagtimes
Returns: Y – each row contains the n observables computed at one of the T lag t imes. Return type: ndarray(T, n)
-
estimates_conf
¶ Returns the confidence intervals of the estimates at different lagtimes (if available).
If not available, returns None.
Returns: - L (ndarray(T, n)) – each row contains the lower confidence bound of n observables computed at one of the T lag times.
- R (ndarray(T, n)) – each row contains the upper confidence bound of n observables computed at one of the T lag times.
-
fit
(X, y=None)¶ 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
-
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
-
classmethod
load
(file_name, model_name='default')¶ Loads a previously saved PyEMMA object from disk.
Parameters: - file_name (str or file like object (has to provide read method)) – The file like object tried to be read for a serialized object.
- model_name (str, default='default') – if multiple models are contained in the file, these can be accessed by
their name. Use
pyemma.list_models()
to get a representation of all stored models.
Returns: obj
Return type: the de-serialized object
-
logger
¶ The logger for this class instance
-
model
¶ The model estimated by this Estimator
-
n_jobs
¶ Returns number of jobs/threads to use during assignment of data.
Returns: - If None it will return the setting of ‘PYEMMA_NJOBS’ or
- ’SLURM_CPUS_ON_NODE’ environment variable. If none of these environment variables exist,
- the number of processors /or cores is returned.
Notes
This setting will effectively be multiplied by the the number of threads used by NumPy for algorithms which use multiple processes. So take care if you choose this manually.
-
name
¶ The name of this instance
-
predictions
¶ Returns tested model predictions at different lagtimes
Returns: Y – each row contains the n observables predicted at one of the T lag times by the tested model. Return type: ndarray(T, n)
-
predictions_conf
¶ Returns the confidence intervals of the estimates at different lagtimes (if available)
If not available, returns None.
Returns: - L (ndarray(T, n)) – each row contains the lower confidence bound of n observables computed at one of the T lag times.
- R (ndarray(T, n)) – each row contains the upper confidence bound of n observables computed at one of the T lag times.
-
save
(file_name, model_name='default', overwrite=False, save_streaming_chain=False)¶ saves the current state of this object to given file and name.
Parameters: - file_name (str) – path to desired output file
- model_name (str, default='default') – creates a group named ‘model_name’ in the given file, which will contain all of the data. If the name already exists, and overwrite is False (default) will raise a RuntimeError.
- overwrite (bool, default=False) – Should overwrite existing model names?
- save_streaming_chain (boolean, default=False) – if True, the data_producer(s) of this object will also be saved in the given file.
Examples
>>> import pyemma, numpy as np >>> from pyemma.util.contexts import named_temporary_file >>> m = pyemma.msm.MSM(P=np.array([[0.1, 0.9], [0.9, 0.1]]))
>>> with named_temporary_file() as file: # doctest: +SKIP ... m.save(file, 'simple') # doctest: +SKIP ... inst_restored = pyemma.load(file, 'simple') # doctest: +SKIP >>> np.testing.assert_equal(m.P, inst_restored.P) # doctest: +SKIP
-
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
-
show_progress
¶ whether to show the progress of heavy calculations on this object.
-