TDE-HMM

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_. If covariance_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 the monitor_ 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.

fit(X, y=None)[source]

Estimate model parameters.

Parameters
  • X (array-like) – The training input samples

  • y (array-like) – The target values

Returns

Returns self

predict_proba(X, y=None)[source]

Find most likely state sequence corresponding to X, then computes y_predict, the predicted labels given X.

Parameters

X – The training input samples

Returns

Returns posteriors, the predicted labels in an tensor