Pipelines

dirichlet_train_pipeline

dirichlet_train_pipeline(labels_path, batch_size=256, n_epochs=1000, gpu_options=None, loss_history='loss_history', model_name='dirichlet')[source]

Train pipeline for Dirichlet model.

This pipeline trains Dirichlet model to find propability of atrial fibrillation. It works with dataset that generates batches of class EcgBatch.

Parameters:
  • labels_path (str) – Path to csv file with true labels.
  • batch_size (int) – Number of samples per gradient update. Default value is 256.
  • n_epochs (int) – Number of times to iterate over the training data arrays. Default value is 1000.
  • gpu_options (GPUOptions) – An argument for tf.ConfigProto gpu_options proto field. Default value is None.
  • loss_history (str) – Name of pipeline variable to save loss values to.
Returns:

pipeline (Pipeline) – Output pipeline.

dirichlet_predict_pipeline

dirichlet_predict_pipeline(model_path, batch_size=100, gpu_options=None, predictions='predictions_list', model_name='dirichlet')[source]

Pipeline for prediction with Dirichlet model.

This pipeline finds propability of atrial fibrillation according to Dirichlet model. It works with dataset that generates batches of class EcgBatch.

Parameters:
  • model_path (str) – path to pretrained DirichletModel
  • batch_size (int) – Number of samples in batch. Default value is 100.
  • gpu_options (GPUOptions) – An argument for tf.ConfigProto gpu_options proto field. Default value is None.
  • predictions (str) – Name of pipeline variable to save predictions to.
Returns:

pipeline (Pipeline) – Output pipeline.

hmm_preprocessing_pipeline

hmm_preprocessing_pipeline(batch_size=20, features='hmm_features')[source]

Preprocessing pipeline for Hidden Markov Model.

This pipeline prepares data for hmm_train_pipeline. It works with dataset that generates batches of class EcgBatch.

Parameters:
  • batch_size (int) – Number of samples in batch. Default value is 20.
  • features (str) – Batch attribute to store calculated features.
Returns:

pipeline (Pipeline) – Output pipeline.

hmm_train_pipeline

hmm_train_pipeline(hmm_preprocessed, batch_size=20, features='hmm_features', channel_ix=0, n_iter=25, random_state=42, model_name='HMM')[source]

Train pipeline for Hidden Markov Model.

This pipeline trains hmm model to isolate QRS, PQ and QT segments. It works with dataset that generates batches of class EcgBatch.

Parameters:
  • hmm_preprocessed (Pipeline) – Pipeline with precomputed hmm features through hmm_preprocessing_pipeline
  • batch_size (int) – Number of samples in batch. Default value is 20.
  • features (str) – Batch attribute to store calculated features.
  • channel_ix (int) – Index of signal’s channel, which should be used in training and predicting.
  • n_iter (int) – Number of learning iterations for HMModel.
  • random_state (int) – Random state for HMModel.
Returns:

pipeline (Pipeline) – Output pipeline.

hmm_predict_pipeline

hmm_predict_pipeline(model_path, batch_size=20, features='hmm_features', channel_ix=0, annot='hmm_annotation', model_name='HMM')[source]

Prediction pipeline for Hidden Markov Model.

This pipeline isolates QRS, PQ and QT segments. It works with dataset that generates batches of class EcgBatch.

Parameters:
  • model_path (str) – Path to pretrained HMModel.
  • batch_size (int) – Number of samples in batch. Default value is 20.
  • features (str) – Batch attribute to store calculated features.
  • channel_ix (int) – Index of channel, which data should be used in training and predicting.
  • annot (str) – Specifies attribute of batch in which annotation will be stored.
Returns:

pipeline (Pipeline) – Output pipeline.