Main Content

Dashboard

In Signal Labeler, you can monitor labeling progress and inspect statistics about your labels using the Dashboard. You can display different charts to quickly determine how many members are labeled, analyze the distributions of each label, and confirm the data is labeled correctly.

In the Selected Definition section of the toolstrip, select one or more label definitions to display from the Definition Selection drop-down list. A separate tab for each label definition appears containing tabs for each type of chart. The charts in the Dashboard provide:

  • Percentage of members labeled

  • Distribution of label values

  • Distribution of region or point instances across members

  • Distribution of region-of-interest (ROI) label duration values

  • Distribution of point label locations in time

  • Distribution of region or point instances across members and label values

By default, the Dashboard displays the percentage of members labeled and the label value distribution of the selected label definition. You can select additional charts from the Plots gallery based on the type of label definition selected (attribute, ROI, or point label).

Tip

  • To close a chart, click on the X of its tab.

  • To close all the charts for a label definition, right-click on the label definition name in its tab and click Close.

  • To change the position of charts shown for a label definition, right-click on any chart or in the label definition tab area and click Sub-Tile to change the layout of charts to Single, Left/Right, or Top/Bottom.

View Labeling Progress

To view your labeling progress, click Dashboard in the toolstrip. By default, the app displays the percentage of members in your data set that have at least one label for the selected label definition.

Tip

You can specify the number of ROI or point labels to count for a member in the progress bar. Click on the plot and type a new Threshold value in the toolstrip.

Dashboard progress bar

Inspect Label Distributions

To assess the quality and accuracy of labels in your data set, select a distribution chart from the drop-down menu in the Plots section of the toolstrip.

Label Value Distribution

You can inspect different label value distributions for attribute, ROI, or point label definitions.

  • Categorical, logical, or string — Each slice of the pie chart represents the number of instances of a particular label value for the selected label definition.

  • Numeric — Each bar in the histogram plot represents the number of instances of a particular label value for the selected label definition.

Time Distribution

You can inspect different time distributions for ROI or point label definitions.

  • Categorical, logical, or string — Each central mark in the box plot represents the median ROI duration or point location of a particular label value for the selected label definition. The bottom and top edges of a box indicate the 25th and 75th percentiles, respectively.

  • Numeric — Each bar in the histogram plot represents the number of instances of an ROI duration or a point location of a particular label value for the selected label definition.

Member Count

You can inspect the distribution of label counts simultaneously across members and across label values for ROI or point label definitions on a heatmap. The horizontal axis represents the count of region or point label instances, the left vertical axis represents the label value, and the right vertical axis represents the number of labeled members.

  • Categorical, logical, or string — Each section in the grid represents the count of those members that have a given number of regions or points. To adjust the number or range of horizontal bins, set the X Bins, X Min, or X Max values in the Member and Region Count section of the toolstrip.

  • Numeric — Each section in the grid represents the count of those members that have a given number of regions or points. You can adjust the number and range of both the horizontal and vertical bins.

Tip

Select a plot to view adjustable settings in the toolstrip.

  • Set the number of bins and limits along the x-axis to better inspect label distributions in a selected histogram or member count plot. You can also modify the number of bins and limits along the y-axis in a member count plot.

  • Plot outliers on the box plot by selecting the Show Outliers check box in the Time Distribution section.

For more information on related distribution charts, see boxplot (Statistics and Machine Learning Toolbox), heatmap, histogram, or pie.

Example: Label ECG Signals and Track Progress

This example shows how to track your labeling progress and assess the quality of labels with the Dashboard. In this mode, you can quickly determine how many members are labeled and inspect the distributions of label values and durations in your data set. This step facilitates the process of obtaining complete and accurate data sets for machine learning.

Download and Prepare the Data

Use the QTdownload function to download the electrocardiogram (ECG) signals from the publicly available QT database [1] [2] to a new temporary directory folder. The code for this function is at the end of the example.

folder = QTdownload;

Each file contains an ECG signal ecgSignal, a table of region labels signalRegionLabels, and the sample rate variable Fs. All signals have a sample rate of 250 Hz. The region labels correspond to three heartbeat morphologies:

  • P wave

  • QRS complex

  • T wave

Create a signal datastore that points to folder. Specify the signal variable name ecgSignal and the sample rate variable Fs.

sds = signalDatastore(folder,'SignalVariableNames','ecgSignal','SampleRateVariableName','Fs');

Create a subset of the datastore containing the first twenty files. Use this subset as the source for a labeledSignalSet object.

subsds = subset(sds,1:20);
lss = labeledSignalSet(subsds);

Label Regions of Interest

Open the Signal Labeler app and import the labeled signal set from the workspace. Plot the first signal in the data set. From the Display tab, select the panner and zoom to a smaller region of the signal for better visualization.

From the Labeler tab, define a categorical region-of-interest (ROI) label with P, QRS and T categories. Name the label BeatMorphologies.

Create a custom labeling function labelECGregions to locate and label the three different regions of interest. Code for the custom function appears later in the example. You can save the function in your current folder, on the MATLAB path, or add it in the app by selecting Add Custom Function in the Automate Value gallery. See Custom Labeling Functions for more information.

Select BeatMorphologies in the Label Definitions browser and choose the labelECGregions function from the Automate Value gallery. Select Auto-Label and then Auto-Label and Inspect Plotted. Click Run. From the Display tab, zoom in on a region of the labeled signal and use the panner to navigate through time. If the labeling is satisfactory, click Save Labels to accept the labels and close the Autolabel tab. You can see the labels and their location values in the Labeled Signal Set Browser.

Visualize Labeling Progress and Statistics

Select the Dashboard in the toolstrip of the Labeler tab. The progress bar shows 5% of members are labeled with at least one ROI label. This corresponds to 1/20 members in the data set. The label distribution pie chart shows the number of instances of each category for the selected label definition.

Close the dashboard and continue your labeling. Select Auto-Label and then Auto-Label All Signals to label the next four signals in the list. Check the box next to the signal names you want to label and then click OK.

Select the Dashboard again. The progress bar now shows 25% of members are labeled. Verify the distribution of each category (P, QRS, or T) is as expected. The Label Distribution pie chart shows that each category makes up about a third of all label instances. Select the Time Distribution histogram chart from the Plots gallery to view the average duration of the P and T waves and QRS complexes, including outliers. Notice the T waves have longer durations than the P waves and QRS complexes.

Display the Member Count chart to better visualize the distribution of labels across members and number of instances. Most members in the data set have between 0–500 instances of P, QRS, and T regions.

Click on the progress bar plot and adjust the Threshold in the toolstrip to count only members with at least 5000 labels. Now only three of the five labeled members are included in the count. Adjust the count threshold to better differentiate between labeled and nonlabeled members based on your labeling requirements.

labelECGregions Function:

The labelECGregions function uses a pretrained deep learning network to identify P, QRS and T heartbeat morphologies in ECG signals.

function [labelVals,labelLocs] = labelECGregions(x,t,parentLabelVal,parentLabelLoc,varargin)

labelVals = cell(2,1);
labelLocs = cell(2,1);

if nargin<5
    Fs = 250;
else
    Fs = varargin{1};
end

% Download the pretrained networks
netURL = 'https://ssd.mathworks.com/supportfiles/SPT/data/QTDatabaseECGSegmentationNetworks.zip'; %#ok<*UNRCH>
modelsFolder = fullfile(tempdir,'QTDatabaseECGSegmentationNetworks');
modelsFile = fullfile(modelsFolder,'trainedNetworks.mat');
zipFile = fullfile(tempdir,'QTDatabaseECGSegmentationNetworks.zip');
    if ~exist(modelsFolder,'dir')
        websave(zipFile,netURL);
        unzip(zipFile,fullfile(tempdir,'QTDatabaseECGSegmentationNetworks'));
    end
load(modelsFile)
    
    for kj = 1:size(x,2)
    
        sig = x(:,kj)';
    
        predTest = classify(rawNet,sig,'MiniBatchSize',50);
        
        msk = signalMask(predTest);
        msk.SpecifySelectedCategories = true;
        msk.SelectedCategories = find(msk.Categories ~= "n/a");
        
        labels = roimask(msk);
        labelVals{kj} = labels.Value;
        labelLocs{kj} = labels.ROILimits/Fs;
    end

labelVals = vertcat(labelVals{:});
labelLocs = cell2mat(labelLocs);

end

QTdownload Function:

You can download the data files from https://www.mathworks.com/supportfiles/SPT/data/QTDatabaseECGData.zip or use the unzip function to create the QTDatabaseECGData folder in your temporary directory with 210 MAT-files in it.

function folder = QTdownload

dataURL = 'https://www.mathworks.com/supportfiles/SPT/data/QTDatabaseECGData1.zip';
datasetFolder = fullfile(tempdir,'QTDataset');
zipFile = fullfile(tempdir,'QTDatabaseECGData.zip');
if ~exist(datasetFolder,'dir')
     websave(zipFile,dataURL);
     unzip(zipFile,tempdir);
end
folder = datasetFolder;

end

References

[1] Goldberger, Ary L., Luis A. N. Amaral, Leon Glass, Jeffery M. Hausdorff, Plamen Ch. Ivanov, Roger G. Mark, Joseph E. Mietus, George B. Moody, Chung-Kang Peng, and H. Eugene Stanley. "PhysioBank, PhysioToolkit, and PhysioNet: Components of a New Research Resource for Complex Physiologic Signals." Circulation. Vol. 101, No. 23, 2000, pp. e215–e220. [Circulation Electronic Pages; http://circ.ahajournals.org/content/101/23/e215.full].

[2] Laguna, Pablo, Roger G. Mark, Ary L. Goldberger, and George B. Moody. "A Database for Evaluation of Algorithms for Measurement of QT and Other Waveform Intervals in the ECG." Computers in Cardiology. Vol.24, 1997, pp. 673–676.

See Also

Apps

Objects

Functions

Related Topics