Пример #1
0
    def __init__(self, c00=True, c0t=False, ctt=False, remove_constant_mean=None, remove_data_mean=False, reversible=False,
                 bessel=True, sparse_mode='auto', modify_data=False, lag=0, weights=None, stride=1, skip=0,
                 chunksize=NotImplemented, ncov_max=float('inf'), column_selection=None, diag_only=False):
        super(LaggedCovariance, self).__init__()
        if chunksize is not NotImplemented:
            import warnings
            from pyemma.util.exceptions import PyEMMA_DeprecationWarning
            warnings.warn('passed deprecated argument chunksize to LaggedCovariance. Will be ignored!',
                          category=PyEMMA_DeprecationWarning)

        if (c0t or ctt) and lag == 0:
            raise ValueError("lag must be positive if c0t=True or ctt=True")

        if remove_constant_mean is not None and remove_data_mean:
            raise ValueError('Subtracting the data mean and a constant vector simultaneously is not supported.')
        if remove_constant_mean is not None:
            remove_constant_mean = ensure_float_vector(remove_constant_mean)
        if column_selection is not None and diag_only:
            raise ValueError('Computing only parts of the diagonal is not supported.')
        if diag_only and sparse_mode is not 'dense':
            if sparse_mode is 'sparse':
                self.logger.warning('Computing diagonal entries only is not implemented for sparse mode. Switching to dense mode.')
            sparse_mode = 'dense'
        self.set_params(c00=c00, c0t=c0t, ctt=ctt, remove_constant_mean=remove_constant_mean,
                        remove_data_mean=remove_data_mean, reversible=reversible,
                        sparse_mode=sparse_mode, modify_data=modify_data, lag=lag,
                        bessel=bessel,
                        weights=weights, stride=stride, skip=skip, ncov_max=ncov_max,
                        column_selection=column_selection, diag_only=diag_only)

        self._rc = None
Пример #2
0
    def __init__(self,
                 c00=True,
                 c0t=False,
                 ctt=False,
                 remove_constant_mean=None,
                 remove_data_mean=False,
                 reversible=False,
                 bessel=True,
                 sparse_mode='auto',
                 modify_data=False,
                 lag=0,
                 weights=None,
                 stride=1,
                 skip=0,
                 chunksize=None,
                 ncov_max=float('inf')):
        super(LaggedCovariance, self).__init__(chunksize=chunksize)

        if (c0t or ctt) and lag == 0:
            raise ValueError("lag must be positive if c0t=True or ctt=True")
        if is_float_vector(weights):
            weights = ensure_float_vector(weights)
        if remove_constant_mean is not None and remove_data_mean:
            raise ValueError(
                'Subtracting the data mean and a constant vector simultaneously is not supported.'
            )
        if remove_constant_mean is not None:
            remove_constant_mean = ensure_float_vector(remove_constant_mean)
        self.set_params(c00=c00,
                        c0t=c0t,
                        ctt=ctt,
                        remove_constant_mean=remove_constant_mean,
                        remove_data_mean=remove_data_mean,
                        reversible=reversible,
                        sparse_mode=sparse_mode,
                        modify_data=modify_data,
                        lag=lag,
                        bessel=bessel,
                        weights=weights,
                        stride=stride,
                        skip=skip,
                        ncov_max=ncov_max)

        self._rc = None
        self._used_data = 0
Пример #3
0
 def expectation(self, a):
     a = _types.ensure_float_vector(a, require_order=True)
     # are we on microstates space?
     if len(a) == self.nstates_obs:
         # project to hidden and compute
         a = _np.dot(self.observation_probabilities, a)
     # now we are on macrostate space, or something is wrong
     if len(a) == self.nstates:
         return _MSM.expectation(self, a)
     else:
         raise ValueError(
             'observable vector a has size %s which is incompatible with both hidden (%s) '
             'and observed states (%s)' %
             (len(a), self.nstates, self.nstates_obs))