API Reference
On this API reference you will find the documentation for the Estimators listed below:
-
class
myHmmPackage.cluster_decoder.
ClusterDecoder
(n_clusters=4, gamma_init=None, decoding_mats_init=None, method='regression', measure='error', max_iter=100.0, reg_param=1e-05, transition_scheme=None, init_scheme=None)[source] ClusterDecoder is an Estimator that performs supervised decoding with a predefined number of decoding matrices. A clustering method is used to choose which decoding matrix to use for each sample of each input data. The metaparameters are gamma_(ndarray, shape (n_time_points, n_clusters)) and decoding_mats_(ndarray, shape (n_clusters, n_time_points, n_label_features))
- Parameters
n_clusters (int) – Number of desired clusters. default=4
gamma_init (ndarray) – The initial value of gamma_. shape=(n_time_points, n_clusters) or None. default=None
decoding_mats_init (ndarray) – The initial value of decoding_mats_. shape=(n_clusters, n_time_points, n_label_features) or None. default=None
method (str) – Name of the decoding method used among ‘sequential’ or ‘regression’. default=’regression’
measure (str) – Measure used for the ‘sequential’ method. default=’error’
max_iter (int) – Number of iterations. default=100
reg_param (float) – Regularization parameter. default=10e-5
transition_scheme (ndarray) – Constraints for the cluster transitions. shape=(n_clusters, n_clusters) or None. default=None
init_scheme (ndarray) – Initial probability for each cluster. shape=(n_clusters,) or None. default=None
- Variables
gamma (ndarray) – The tensor containing each cluster’s probability time-course, of shape=(n_time_points, n_clusters).
decoding_mats (ndarray) – The tensor containing the decoding matrices associated to each cluster, of shape=(n_clusters, n_time_points, n_label_features).
-
fit
(X, y)[source] Estimate model parameters.
- Parameters
X (array-like) – The training input samples (brain data) of shape=(n_samples, n_time_points, n_regions)
y (array-like) – The target values, An array of int and of shape=(n_samples, n_time_points, n_label_features)
- Returns
Returns self
-
predict
(X)[source] Find most likely state sequence corresponding to X, then computes y_predict, the predicted labels given X.
- Parameters
X – The training input samples (brain data) of shape=(n_samples, n_time_points, n_regions)
- Returns
Returns y_predict, the predicted labels in an tensor of shape=(n_samples, n_time_points, n_label_features)
-
class
myHmmPackage.tde_hmm.
TDE_HMM
(n_components=3, covariance_type='full', min_covar=0.001, startprob_prior=1.0, transmat_prior=1.0, means_prior=0, means_weight=0, covars_prior=0.01, covars_weight=1, algorithm='viterbi', random_state=None, n_iter=10, tol=0.01, verbose=False, params='stmc', init_params='stmc')[source] TDE_HMM is an Estimator that performs supervised decoding with a predefined number of decoding matrices. A clustering method is used to choose which decoding matrix to use for each sample of each input data.
- Parameters
n_components (int) – Number of states. Default 3
n_iter (int) – Optional. Maximum number of iterations to perform.
covariance_type (str) –
Optional. The type of covariance parameters to use: * “spherical” — each state uses a single variance value that
applies to all features (default).
”diag” — each state uses a diagonal covariance matrix.
”full” — each state uses a full (i.e. unrestricted) covariance matrix.
”tied” — all states use the same full covariance matrix.
min_covar (float) – Optional. Floor on the diagonal of the covariance matrix to prevent overfitting. Defaults to 1e-3.
startprob_prior (array) – Optional. Shape of (n_components, ). Parameters of the Dirichlet prior distribution for
startprob_
.transmat_prior (array) – Optional. Shape of (n_components, n_components). Parameters of the Dirichlet prior distribution for each row of the transition probabilities
transmat_
.means_prior/means_weight (array) – Optional. Shape of (n_components, ). Mean and precision of the Normal prior distribtion for
means_
.covars_prior/covars_weight (array) – Optional. Shape of (n_components, ). Parameters of the prior distribution for the covariance matrix
covars_
. Ifcovariance_type
is “spherical” or “diag” the prior is the inverse gamma distribution, otherwise — the inverse Wishart distribution.algorithm (str) – Optional. {“viterbi”, “map”} Decoder algorithm.
random_state (int_seed) – Optional. A random number generator instance.
tol (float) – Optional. Convergence threshold. EM will stop if the gain in log-likelihood is below this value.
verbose (bool) – Optional. Whether per-iteration convergence reports are printed to
sys.stderr
. Convergence can also be diagnosed using themonitor_
attribute.params/init_params (str) – Optional. The parameters that get updated during (
params
) or initialized before (init_params
) the training. Can contain any combination of ‘s’ for startprob, ‘t’ for transmat, ‘m’ for means, and ‘c’ for covars. Defaults to all parameters.implementation (str) – Optional. Determines if the forward-backward algorithm is implemented with logarithms (“log”), or using scaling (“scaling”). The default is to use logarithms for backwards compatability.