# Ecg Heartbeat Classification Eval

> Evaluates a deep convolutional neural network's ability to classify ECG heartbeats into arrhythmia categories and detect myocardial infarction using transferable learned representations. The protocol tests both in-domain arrhythmia classification and cross-domain transfer learning for MI detection. Use when the user wants to benchmark on MIT-BIH Arrhythmia Database, PTB Diagnostics, or asks about evaluating this task. Reports accuracy.

- Skill: `qhjqhj00/ecg-heartbeat-classification-eval` (Agent Skill)
- Install (CLI): `npx skillmds add qhjqhj00/ecg-heartbeat-classification-eval`
- Raw SKILL.md: https://api.skillmd.com/api/skills/qhjqhj00/ecg-heartbeat-classification-eval/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Productivity
- Author: qhjqhj00 (https://skillmd.com/u/qhjqhj00)
- Updated: 2026-09-08
- Page: https://skillmd.com/skills/qhjqhj00/ecg-heartbeat-classification-eval

---


# ecg-heartbeat-classification-eval

> ECG Heartbeat Classification: A Deep Transferable Representation — Kachuee et al. (2018) (arXiv:1805.00794, 2018)

## What this evaluates

Evaluates a deep convolutional neural network's ability to classify ECG heartbeats into arrhythmia categories and detect myocardial infarction using transferable learned representations. The protocol tests both in-domain arrhythmia classification and cross-domain transfer learning for MI detection.

## Datasets

- **MIT-BIH Arrhythmia Database** — total ?; splits: test (4079)
- **PTB Diagnostics** — total ?; splits: train (-1), test (-1)

## Metrics

- `accuracy` **(primary)** — range: percent
  - Proportion of correctly classified instances out of the total number of instances in the test set.
- `precision` — range: percent
  - Ratio of true positive predictions to the total number of positive predictions (TP / (TP + FP)).
- `recall` — range: percent
  - Ratio of true positive predictions to the total number of actual positives (TP / (TP + FN)).

## Input / output format

**Input**: Fixed-length ECG heartbeat segments extracted via R-peak detection and aligned using median R-R intervals. Single-lead (Lead II) signals for PTB; unspecified lead configuration for MIT-BIH.

**Output**: Discrete class labels corresponding to arrhythmia types or myocardial infarction status.

## Scoring recipe

```python
def compute_metrics(predictions, gold_labels):
    n = len(gold_labels)
    accuracy = sum(1 for p, g in zip(predictions, gold_labels) if p == g) / n
    precisions, recalls = [], []
    for cls in unique_classes:
        tp = sum(1 for p, g in zip(predictions, gold_labels) if p == cls and g == cls)
        fp = sum(1 for p, g in zip(predictions, gold_labels) if p == cls and g != cls)
        fn = sum(1 for p, g in zip(predictions, gold_labels) if p != cls and g == cls)
        precisions.append(tp / (tp + fp) if (tp + fp) > 0 else 0)
        recalls.append(tp / (tp + fn) if (tp + fn) > 0 else 0)
    avg_precision = sum(precisions) / len(precisions)
    avg_recall = sum(recalls) / len(recalls)
    return accuracy, avg_precision, avg_recall
```

## Common pitfalls

- Dataset sizes and exact train/test splits are not fully specified (e.g., PTB total size unknown, only 80/20 ratio given).
- Direct comparison with prior work is confounded by input modality differences (12-lead vs. single Lead II ECG).
- Class balancing relies on data augmentation, but specific augmentation techniques are not detailed in the results section.

## Evidence (verbatim from paper)

> Table III presents a comparison between the average accuracy, precision, and recall of the proposed method for MI classification and other work in the literature.

## Citation

```bibtex
@misc{kachuee2018ecg,
  title={ECG Heartbeat Classification: A Deep Transferable Representation},
  author={Kachuee et al. (2018)},
  year={2018},
  note={arXiv:1805.00794}
}
```

- arXiv: 1805.00794

