Models¶
DirichletModel¶
- 
class 
DirichletModel(*args, **kwargs)[source]¶ Bases:
cardio.models.dirichlet_model.dirichlet_model.DirichletModelBaseDirichlet model with overloaded train and predict methods.
trainmethod is identical toDirichletModelBase.train, but also acceptsargsandkwargs.predictmethod splits the resulting tensor forparametersfetch usingsplit_indices. It also splits and aggregates results forpredictionsfetch to get class probabilities.
- 
predict(fetches=None, feed_dict=None, split_indices=None)[source]¶ Get predictions on the data provided.
Parameters: - fetches (tf.Operation or tf.Tensor or array-like sequence of them) – Graph element to evaluate.
If 
fetchescontainsparameterstensor, the corresponding output is split usingsplit_indices. Iffetchescontainspredictionstensor, the corresponding output is split usingsplit_indicesand then aggregated to get class probabilities. - feed_dict (dict) – A dictionary that maps graph elements to values.
 - split_indices (1-D ndarray) – Indices used to split 
parametersandpredictionstensors. 
Returns: output (same structure as
fetches) – Calculated values for each element infetches.- fetches (tf.Operation or tf.Tensor or array-like sequence of them) – Graph element to evaluate.
If 
 
- 
train(fetches=None, feed_dict=None, use_lock=False, *args, **kwargs)[source]¶ Train the model with the data provided.
The only difference between
DirichletModel.trainandTFModel.trainis that the former also acceptsargsandkwargs.Parameters: Returns: output (same structure as
fetches) – Calculated values for each element infetches.
DirichletModelBase¶
- 
class 
DirichletModelBase(*args, **kwargs)[source]¶ Bases:
cardio.dataset.dataset.models.tf.base.TFModelDirichlet model class.
The model predicts Dirichlet distribution parameters from which class probabilities are sampled.
Notes
Configuration
Model config must contain the following keys:
- input_shape : tuple
 Input signals’s shape without the batch dimension.
- class_names : array_like
 Class names.
- loss : 
None The model has a predefined loss, so you should leave it
None.
- loss : 
 
HMModel¶
- 
class 
HMModel(*args, **kwargs)[source]¶ Bases:
cardio.dataset.dataset.models.base.BaseModelHidden Markov Model.
This implementation is based on
hmmlearnAPI. It is supposed that estimators ofHMModelare model classes ofhmmlearn.- 
train(X, lengths=None, *args, **kwargs)[source]¶ Train the model using data provided.
Parameters: - X (array-like) – A matrix of observations. Should be of shape (n_samples, n_features).
 - lengths (array-like of integers optional) – If present, should be of shape (n_sequences, ).
Lengths of the individual sequences in 
X. The sum of these should ben_samples. 
Notes
For more details and other parameters look at the documentation for the estimator used.
- 
predict(X, lengths=None, *args, **kwargs)[source]¶ Make prediction with the data provided.
Parameters: - X (array-like) – A matrix of observations. Should be of shape (n_samples, n_features).
 - lengths (array-like of integers optional) – If present, should be of shape (n_sequences, ).
Lengths of the individual sequences in 
X. The sum of these should ben_samples. 
Returns: output (array) – Labels for each sample of X.
Notes
For more details and other parameters look at the documentation for the estimator used.
-