Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def clustercenter(self, i):
"""
returns the cluster centers
"""
jclustercenters = self._jclustering.getClusterCenter(i)
return stallone.stallone_array_to_ndarray(jclustercenters)
def clustercenter(self, i):
"""
returns the cluster centers
"""
jclustercenters = self._jclustering.getClusterCenter(i)
return stallone.stallone_array_to_ndarray(jclustercenters)
def add(self, x):
import pyemma.util.pystallone as stallone
self._jwriter.add(stallone.ndarray_to_stallone_array(x))
def assign(self, X):
r"""Assigns point X to a cluster and returns its index.
Parameters
----------
X : numpy ndarray
coordinate set to be assigned
"""
jX = stallone.ndarray_to_stallone_array(X)
return self._jclustering.assign(jX)
sdtrajs = []
# make a Java List
for dtraj in dtrajs:
sdtrajs.append(stallone.ndarray_to_stallone_array(dtraj))
jlist = jpype.java.util.Arrays.asList(sdtrajs)
# prepare run parameters
timeshift = max(lag/10, 1); # by default, use 10 shifts per lag, but at least 1
if (maxiter is None):
maxiter = 100 * nstate * nstate; # by default use 100 nstate^2
# convergence when likelihood increases by no more than dlconv
dectol = -conv;
# do not set initial values for hidden transition matrix or output probabilities (will be obtained by PCCA+)
TCinit = None;
chiInit = None;
# run estimation
self.hmm = stallone.API.hmm.pmm(jlist, nstate, lag, timeshift, maxiter, dectol, TCinit, chiInit)
# coding=utf-8
r"""
================================
Clustering Coordinates API
================================
"""
__docformat__ = "restructuredtext en"
from pyemma.util.pystallone import jarray
from pyemma.util import pystallone as stallone
from . import clustering
# shortcuts
intseqNew = stallone.API.intseqNew
intseq = stallone.API.intseq
dataNew = stallone.API.dataNew
data = stallone.API.data
clusterNew = stallone.API.clusterNew
cluster = stallone.API.cluster
#
Clustering = clustering.Clustering
__author__ = "Martin Scherer, Frank Noe"
__copyright__ = "Copyright 2014, Computational Molecular Biology Group, FU-Berlin"
__credits__ = ["Martin Scherer", "Frank Noe"]
__license__ = "FreeBSD"
__version__ = "2.0.0"
__maintainer__ = "Martin Scherer"
__email__="m.scherer AT fu-berlin DOT de"
the corresponding data elements are selected.
For molecular data, instead of the full (N x 3) arrays, a (n x 3) subset
will be returned.
Parameters
----------
select = None : list of integers
atoms or dimension selection.
"""
# when a change is made:
if (not np.array_equal(selection, self._selection)):
self._selection = selection
if (selection is None):
self._java_reader.select(None)
else:
self._java_reader.select(stallone.jarray(selection))
[0, 10, 20, ...]
[2, 12, 22, ...]
[4, 14, 24, ...]
[6, 16, 26, ...]
[8, 18, 28, ...]
Basicly, when timeshift = 1, all data will be used, while for > 1 data will be subsampled. Setting
timeshift greater than tau will have no effect, because at least the first subtrajectory will be
used.
"""
# format input data
if (type(dtrajs) is np.ndarray):
dtrajs = [dtrajs]
sdtrajs = []
# make a Java List
for dtraj in dtrajs:
sdtrajs.append(stallone.ndarray_to_stallone_array(dtraj))
jlist = jpype.java.util.Arrays.asList(sdtrajs)
# prepare run parameters
timeshift = max(lag/10, 1); # by default, use 10 shifts per lag, but at least 1
if (maxiter is None):
maxiter = 100 * nstate * nstate; # by default use 100 nstate^2
# convergence when likelihood increases by no more than dlconv
dectol = -conv;
# do not set initial values for hidden transition matrix or output probabilities (will be obtained by PCCA+)
TCinit = None;
chiInit = None;
# run estimation
self.hmm = stallone.API.hmm.pmm(jlist, nstate, lag, timeshift, maxiter, dectol, TCinit, chiInit)
def eigenvectors(self):
"""
Returns the eigenvector matrix of the covariance matrix
with eigenvectors as column vectors
"""
if (self._evec is None):
self._evec = stallone.stallone_array_to_ndarray(self.jtransform().getEigenvectorMatrix())
return self._evec
def __init__(self, dtrajs, nstate, lag=1, conv=0.01, maxiter=None, timeshift=None,
TCinit=None, chiInit=None):
lag = int(lag)
# format input data
if (type(dtrajs) is np.ndarray):
dtrajs = [dtrajs]
sdtrajs = []
# make a Java List
for dtraj in dtrajs:
sdtrajs.append(stallone.ndarray_to_stallone_array(dtraj))
jlist = stallone.java.util.Arrays.asList(sdtrajs)
# prepare run parameters
# by default, use 10 shifts per lag, but at least 1
timeshift = max(lag / 10, 1)
if (maxiter is None):
maxiter = 100 * nstate * nstate # by default use 100 nstate^2
# convergence when likelihood increases by no more than dlconv
dectol = -conv
# convert initial values
if TCinit is not None:
TCinit = stallone.ndarray_to_stallone_array(TCinit)
if chiInit is not None:
chiInit = stallone.ndarray_to_stallone_array(chiInit)
# run estimation
try:
self.hmm = stallone.API.hmm.pmm(jlist, nstate, lag, timeshift,