Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def transition_matrix(self):
"""
Returns the hidden transition matrix
"""
return stallone.stallone_array_to_ndarray(self.hmm.getTransitionMatrix())
def covariance_matrix_lagged(self):
"""
Returns the lagged covariance matrix estimated from the data
"""
return stallone.stallone_array_to_ndarray(self.__jtransform().getCovarianceMatrixLagged())
# load input
datainput = dataNew.dataInput(stallone.list_to_java_list(infiles))
nseq = datainput.numberOfSequences()
# assign data
res = []
for i in xrange(nseq):
seq = datainput.getSequence(i)
jdtraj = cluster.discretize(seq, idisc)
# write to file if requested
if (outfiles is not None):
intseq.writeIntSequence(jdtraj, outfiles[i])
# store return data if requested
if (return_discretization):
dtraj = stallone.stallone_array_to_ndarray(jdtraj)
res.append(dtraj)
# return discrete trajectories if requested
if (return_discretization):
if singlefile:
return res[0]
else:
return res
def output_matrix(self):
"""
Returns the output probability matrix B, with b_ij
containing the probability that hidden state i will output to observable state j
"""
return stallone.stallone_array_to_ndarray(self.hmm.getOutputParameters())
def transform(self, x):
"""
Transforms input data x
WARNING: This is generally inefficient due to the current python-java
interface - so using this might slow your code down. The prefered
way of doing transforms is through the mass transform functions of
the transform api (e.g. transform_file).
Subclasses of CoordinateTransform might have an efficient implementation.
"""
y = self._jcoordinatetransform.transform(stallone.ndarray_to_stallone_array(x))
return stallone.stallone_array_to_ndarray(y)
def mean(self):
"""
Returns the mean vector estimated from the data
"""
return stallone.stallone_array_to_ndarray(self.jtransform().getMeanVector())