{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.11.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":97984,"databundleVersionId":14096757,"sourceType":"competition"}],"dockerImageVersionId":31153,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"Published on October 21, 2025. By Prata, Marília (mpwolke)","metadata":{}},{"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport matplotlib.pyplot as plt\nimport seaborn as sns\n%matplotlib inline\n\nfrom matplotlib.gridspec import GridSpec\n\n#Two lines Required to Plot Plotly\nimport plotly.io as pio\npio.renderers.default = 'iframe'\n\nimport plotly.graph_objs as go\nimport plotly.offline as py\nimport plotly.express as px\n\n#Ignore warnings\nimport warnings\nwarnings.filterwarnings('ignore')\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true,"_kg_hide-input":true,"_kg_hide-output":true,"execution":{"iopub.status.busy":"2025-10-21T19:44:47.672013Z","iopub.execute_input":"2025-10-21T19:44:47.672372Z","iopub.status.idle":"2025-10-21T19:45:00.731023Z","shell.execute_reply.started":"2025-10-21T19:44:47.672303Z","shell.execute_reply":"2025-10-21T19:45:00.729922Z"},"collapsed":true,"jupyter":{"outputs_hidden":true}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"![](https://www.saem.org/images/default-source/academy-images/cdem/picture1b6cb1a73-b04a-411a-aaa2-241e9a8ba757.png?sfvrsn=b20cf159_1)SAEM","metadata":{}},{"cell_type":"markdown","source":"## About Competition: Extract the ECG time-series data\n\nExtract the ECG time-series data from scans and photographs of paper printouts of the ECGs.\n\n\"You will build models to extract time series data from Electrocardiogram (ECG) images. ECGs are used to diagnose and guide treatment for heart disease. They exist as physical printouts, scanned images, photographs, or time series. Medical-grade ECG software currently works best on time series. Tools for extracting time series from ECG images can help convert billions of ECG images collected globally over decades into data for training better diagnostic models to improve clinical outcomes.\"\n\nhttps://www.kaggle.com/competitions/physionet-ecg-image-digitization/overview","metadata":{}},{"cell_type":"markdown","source":"## Competition Citation\n\n@misc{physionet-ecg-image-digitization,\n\n    author = {Matthew A. Reyna and Deepanshi and James Weigle and Zuzana Koscova and Kiersten Campbell and Salman Seyedi and Andoni Elola and Ali Bahrami Rad and Amit J Shah and Neal K. Bhatia and Yao Yan and Sohier Dane and Addison Howard and Gari D. Clifford and Reza Sameni},\n    \n    title = {PhysioNet - Digitization of ECG Images},\n    year = {2025},\n    \n    howpublished = {\\url{https://kaggle.com/competitions/physionet-ecg-image-digitization}},\n    note = {Kaggle}\n}","metadata":{}},{"cell_type":"markdown","source":"## ECG leads\n\nlead: One of the 12 standard ECG leads: I, II, III, aVR, aVL, aVF, V1, V2, V3, V4, V5,V6.\n\n\"ECG leads are different \"views\" or representations of the heart's electrical activity, calculated from data gathered by physical electrodes placed on the skin. A standard 12-lead ECG uses 10 electrodes to generate 12 different views, categorized as 6 limb leads (I, II, III, aVR, aVL, aVF) and 6 precordial (chest) leads (V1–V6). This provides a comprehensive picture of the heart from multiple angles to help diagnose issues.\"","metadata":{}},{"cell_type":"code","source":"##One lead (train/[id]/[id].csv)\n\nlead = pd.read_csv('/kaggle/input/physionet-ecg-image-digitization/train/735384893/735384893.csv')\nlead.tail()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-10-21T20:20:06.434996Z","iopub.execute_input":"2025-10-21T20:20:06.435403Z","iopub.status.idle":"2025-10-21T20:20:06.487544Z","shell.execute_reply.started":"2025-10-21T20:20:06.435375Z","shell.execute_reply":"2025-10-21T20:20:06.486587Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"lead.info()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-10-21T19:09:51.160807Z","iopub.execute_input":"2025-10-21T19:09:51.161681Z","iopub.status.idle":"2025-10-21T19:09:51.173324Z","shell.execute_reply.started":"2025-10-21T19:09:51.161652Z","shell.execute_reply":"2025-10-21T19:09:51.171748Z"},"_kg_hide-output":true},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"## 12-lead ECG\n\n* 10 electrodes required to produce 12-lead ECG\n   4 Electrodes on all 4 limbs (RA, LL, LA, RL)6 Electrodes on precordium (V1–6) \n* Monitors 12 leads (V1–6), (I, II, III) and (aVR, aVF, aVL)\n* Allows interpretation of specific areas of the heart\nInferior (II, III, aVF)Lateral (I, aVL, V5, V6)Anterior (V1–4)\n\n**12-lead Precordial lead placement**\n\n* V1: 4th intercostal space (ICS), RIGHT margin of the sternum\n* V2:  4th ICS along the LEFT margin of the sternum\n* V4: 5th ICS, mid-clavicular line\n* V3: midway between V2 and V4\n* V5:  5th ICS, anterior axillary line (same level as V4)\n* V6:  5th ICS, mid-axillary line (same level as V4)","metadata":{}},{"cell_type":"markdown","source":"## ECG leads Histograms","metadata":{}},{"cell_type":"code","source":"lead.hist(figsize=(15,10), bins=30, color='green', edgecolor='black')\nplt.suptitle(\"Histogram of ECG Leads\")\nplt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-10-21T19:11:55.864750Z","iopub.execute_input":"2025-10-21T19:11:55.865160Z","iopub.status.idle":"2025-10-21T19:11:58.610305Z","shell.execute_reply.started":"2025-10-21T19:11:55.865135Z","shell.execute_reply":"2025-10-21T19:11:58.609255Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"test = pd.read_csv('/kaggle/input/physionet-ecg-image-digitization/test.csv')\ntest.head()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-10-21T18:59:28.071888Z","iopub.execute_input":"2025-10-21T18:59:28.072253Z","iopub.status.idle":"2025-10-21T18:59:28.085417Z","shell.execute_reply.started":"2025-10-21T18:59:28.072226Z","shell.execute_reply":"2025-10-21T18:59:28.084543Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#By Pedro Andrade https://www.kaggle.com/code/pbizil/datahackers-managers-radiografia-dos-gestores\n\nlead_counts = test[\"lead\"].value_counts().head(12)#Try different values of head\nsns.set(style=\"white\")\nplt.figure(figsize=(10, 10))\n#x=type_counts.index, y=loc_counts.values\nax = sns.barplot(x=lead_counts.index, y=lead_counts.values, color=sns.color_palette(\"Greens\", n_colors=5)[3])\nplt.title(\"Distribution of ECG Leads\", fontsize=16)\nplt.xlabel(\"Tags\", fontsize=12)\nplt.ylabel(\"Frequency\", fontsize=12)\nplt.xticks(rotation=45, fontsize=11)\nplt.yticks(fontsize=11)\nsns.despine()\n\n#+2 is good if chart is vertical. +20 worked for horizontal\nfor i, v in enumerate(lead_counts.values):\n    ax.text(i, v + 2, str(v), ha='center', va='bottom', fontsize=10)\n\nplt.tight_layout()\nplt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-10-21T19:02:14.233524Z","iopub.execute_input":"2025-10-21T19:02:14.233832Z","iopub.status.idle":"2025-10-21T19:02:14.557899Z","shell.execute_reply.started":"2025-10-21T19:02:14.233808Z","shell.execute_reply":"2025-10-21T19:02:14.556894Z"},"_kg_hide-input":true},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"## Load the sample_submission parquet ","metadata":{}},{"cell_type":"code","source":"#Read One parquet file. \nsub = pd.read_parquet(\"../input/physionet-ecg-image-digitization/sample_submission.parquet\")\nsub.tail()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-10-21T18:29:14.626847Z","iopub.execute_input":"2025-10-21T18:29:14.627884Z","iopub.status.idle":"2025-10-21T18:29:14.905387Z","shell.execute_reply.started":"2025-10-21T18:29:14.627844Z","shell.execute_reply":"2025-10-21T18:29:14.904278Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"## ECG-Image-Database: Digitization and Analysis\n\nECG-Image-Database: A Dataset of ECG Images with Real-World Imaging and Scanning Artifacts; A Foundation for Computerized ECG Image Digitization and Analysis\n\nAuthors: Matthew A. Reyna, Deepanshi, James Weigle, Zuzana Koscova, Kiersten Campbell, Kshama Kodthalu Shivashankara, Soheil Saghafi, Sepideh Nikookar, Mohsen Motie-Shirazi, Yashar Kiarashi, Salman Seyedi, Gari D. Clifford, Reza Sameni\n\n\"The authors introduced the ECG-Image-Database, a large and diverse collection of electrocardiogram (ECG) images generated from ECG time-series data, with real-world scanning, imaging, and physical artifacts. They used **ECG-Image-Kit**, an open-source Python toolkit, to generate realistic images of 12-lead ECG printouts from raw ECG time-series.\"\n\n\"The resulting dataset includes 35,595 software-labeled ECG images with a wide range of imaging artifacts and distortions. The dataset provides ground truth time-series data alongside the images, offering a reference for developing machine and **deep learning models for ECG digitization and classification**.\"\n\n\"The dataset aims to serve as a reference for ECG digitization and computerized annotation efforts. ECG-Image-Database was used in the PhysioNet Challenge 2024 on ECG image digitization and classification.\"\n\nhttps://arxiv.org/abs/2409.16612","metadata":{}},{"cell_type":"code","source":"train = pd.read_csv('/kaggle/input/physionet-ecg-image-digitization/train.csv')\ntrain.head()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-10-21T18:38:53.057372Z","iopub.execute_input":"2025-10-21T18:38:53.057720Z","iopub.status.idle":"2025-10-21T18:38:53.080972Z","shell.execute_reply.started":"2025-10-21T18:38:53.057693Z","shell.execute_reply":"2025-10-21T18:38:53.079621Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"## info() method - train file ","metadata":{}},{"cell_type":"code","source":"train.info()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-10-21T18:50:18.824734Z","iopub.execute_input":"2025-10-21T18:50:18.825086Z","iopub.status.idle":"2025-10-21T18:50:18.844120Z","shell.execute_reply.started":"2025-10-21T18:50:18.825059Z","shell.execute_reply":"2025-10-21T18:50:18.843052Z"},"_kg_hide-output":true},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"## Histograms (train file)\n\n**fs**: The sampling frequency of the corresponding ECG signal.\n\n**sig_len**: The full sequence length of the ECG measurements. For the competition data this is always 10 seconds * fs. Note that clinical ECGs can have different durations. Kindly consider making your code robust to other durations though this is not a requirement of participation.\n\nAlmost the same since sig_len has the equal values with one Zero more.","metadata":{}},{"cell_type":"code","source":"numerical_cols = ['id', 'fs', 'sig_len']\n\ntrain[numerical_cols].hist(figsize=(15,10), bins=30, color='green', edgecolor='black')\nplt.suptitle(\"Histogram of Numeric Features\")\nplt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-10-21T18:42:08.677639Z","iopub.execute_input":"2025-10-21T18:42:08.677990Z","iopub.status.idle":"2025-10-21T18:42:09.566719Z","shell.execute_reply.started":"2025-10-21T18:42:08.677965Z","shell.execute_reply":"2025-10-21T18:42:09.565725Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"## Imports to check images","metadata":{}},{"cell_type":"code","source":"import random\nfrom glob import glob\nimport cv2\nimport glob\nfrom PIL import Image","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-10-21T19:45:09.624452Z","iopub.execute_input":"2025-10-21T19:45:09.624763Z","iopub.status.idle":"2025-10-21T19:45:10.035664Z","shell.execute_reply.started":"2025-10-21T19:45:09.624741Z","shell.execute_reply":"2025-10-21T19:45:10.034689Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"DATA_PATH = \"../input/physionet-ecg-image-digitization/\"","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-10-21T19:45:16.026104Z","iopub.execute_input":"2025-10-21T19:45:16.026424Z","iopub.status.idle":"2025-10-21T19:45:16.030821Z","shell.execute_reply.started":"2025-10-21T19:45:16.026402Z","shell.execute_reply":"2025-10-21T19:45:16.029802Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"image_paths = sorted(glob.glob(os.path.join(DATA_PATH, '**/**/*.png')))","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-10-21T19:45:20.948711Z","iopub.execute_input":"2025-10-21T19:45:20.949082Z","iopub.status.idle":"2025-10-21T19:45:21.870958Z","shell.execute_reply.started":"2025-10-21T19:45:20.949048Z","shell.execute_reply":"2025-10-21T19:45:21.869883Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"## len (number of images)","metadata":{}},{"cell_type":"code","source":"print(f\"Number of images: {len(image_paths)}\")","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-10-21T19:23:03.988676Z","iopub.execute_input":"2025-10-21T19:23:03.988979Z","iopub.status.idle":"2025-10-21T19:23:03.994709Z","shell.execute_reply.started":"2025-10-21T19:23:03.988955Z","shell.execute_reply":"2025-10-21T19:23:03.993428Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"## We have 10 images, though I could display only 4. Why?","metadata":{}},{"cell_type":"code","source":"def plotImages(tools,directory):\n    print(tools)\n    multipleImages = glob.glob(directory)\n    plt.rcParams['figure.figsize'] = (8, 8) #Original is 15,15. Since we have 18 veggies I decreased the size\n    plt.subplots_adjust(wspace=0, hspace=0)\n    i_ = 0\n    for l in multipleImages[:4]: #Original is 25\n        im = cv2.imread(l)\n        im = cv2.resize(im, (256, 256)) \n        plt.subplot(5, 5, i_+1) #.set_title(l)\n        plt.imshow(cv2.cvtColor(im, cv2.COLOR_BGR2RGB)); plt.axis('off')\n        i_ += 1\n\nplotImages(\"ECG 10140238 train images\",\"../input/physionet-ecg-image-digitization/train/10140238/**\")","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-10-21T19:34:14.282811Z","iopub.execute_input":"2025-10-21T19:34:14.283191Z","iopub.status.idle":"2025-10-21T19:34:15.813926Z","shell.execute_reply.started":"2025-10-21T19:34:14.283149Z","shell.execute_reply":"2025-10-21T19:34:15.812786Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"## Test images (Only 2)","metadata":{}},{"cell_type":"code","source":"def plotImages(tools,directory):\n    print(tools)\n    multipleImages = glob.glob(directory)\n    plt.rcParams['figure.figsize'] = (15, 15) #Original is 15,15. Since we have 18 veggies I decreased the size\n    plt.subplots_adjust(wspace=0, hspace=0)\n    i_ = 0\n    for l in multipleImages[:25]:\n        im = cv2.imread(l)\n        im = cv2.resize(im, (512, 512)) \n        plt.subplot(5, 2, i_+1) #.set_title(l)\n        plt.imshow(cv2.cvtColor(im, cv2.COLOR_BGR2RGB)); plt.axis('off')\n        i_ += 1\n\nplotImages(\"ECG test images\",\"../input/physionet-ecg-image-digitization/test/**\")","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-10-21T19:51:59.878796Z","iopub.execute_input":"2025-10-21T19:51:59.879590Z","iopub.status.idle":"2025-10-21T19:52:00.284960Z","shell.execute_reply.started":"2025-10-21T19:51:59.879560Z","shell.execute_reply":"2025-10-21T19:52:00.284080Z"},"_kg_hide-input":true},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"## Open Pil to check ECG details above\n\nOne image is male the other png (female). I displayed only the male image.","metadata":{}},{"cell_type":"code","source":"imgs_dir = '../input/physionet-ecg-image-digitization/test/'\nImage.open(imgs_dir + '2352854581.png')","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-10-21T19:53:39.427217Z","iopub.execute_input":"2025-10-21T19:53:39.427589Z","iopub.status.idle":"2025-10-21T19:53:39.739632Z","shell.execute_reply.started":"2025-10-21T19:53:39.427564Z","shell.execute_reply":"2025-10-21T19:53:39.738410Z"},"_kg_hide-input":true},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"## That's an Experimental code that I'll try to adapt here\n\nRead the original to understand what I intended to do. \nUnfortunately, I didn't it.","metadata":{}},{"cell_type":"code","source":"#By Gregoire DC https://www.kaggle.com/code/gregoiredc/arrhythmia-on-ecg-classification-using-cnn/notebook\n\ndef plot_hist(class_number,size,min_,bins):\n    img=lead.loc[lead[:11]==class_number].values\n    img=img[:,min_:size]\n    img_flatten=img.flatten()\n\n    final1=np.arange(min_,size)\n    for i in range (img.shape[0]-1):\n        tempo1=np.arange(min_,size)\n        final1=np.concatenate((final1, tempo1), axis=None)\n    print(len(final1))\n    print(len(img_flatten))\n    plt.hist2d(final1,img_flatten, bins=(bins,bins),cmap=plt.cm.jet)\n    plt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-10-21T20:25:40.333397Z","iopub.execute_input":"2025-10-21T20:25:40.333702Z","iopub.status.idle":"2025-10-21T20:25:40.340034Z","shell.execute_reply.started":"2025-10-21T20:25:40.333681Z","shell.execute_reply":"2025-10-21T20:25:40.339134Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"## The original data has 187 columns. I changed 187 to V6. ","metadata":{}},{"cell_type":"code","source":"#By Gregoire DC https://www.kaggle.com/code/gregoiredc/arrhythmia-on-ecg-classification-using-cnn/notebook\n\nc=lead.groupby('V6',group_keys=False).apply(lambda lead : lead.sample(1))","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-10-21T20:28:00.579798Z","iopub.execute_input":"2025-10-21T20:28:00.580112Z","iopub.status.idle":"2025-10-21T20:28:00.644194Z","shell.execute_reply.started":"2025-10-21T20:28:00.580088Z","shell.execute_reply":"2025-10-21T20:28:00.643397Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"## That's c  (= our train/[id]/[id].csv)","metadata":{}},{"cell_type":"code","source":"c","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-10-21T20:28:15.347253Z","iopub.execute_input":"2025-10-21T20:28:15.347617Z","iopub.status.idle":"2025-10-21T20:28:15.366117Z","shell.execute_reply.started":"2025-10-21T20:28:15.347592Z","shell.execute_reply":"2025-10-21T20:28:15.365172Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":" plt.plot(c.iloc[:11]);","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-10-21T20:29:04.699001Z","iopub.execute_input":"2025-10-21T20:29:04.699467Z","iopub.status.idle":"2025-10-21T20:29:04.944273Z","shell.execute_reply.started":"2025-10-21T20:29:04.699434Z","shell.execute_reply":"2025-10-21T20:29:04.943283Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#By Gregoire DC https://www.kaggle.com/code/gregoiredc/arrhythmia-on-ecg-classification-using-cnn/notebook\n\ndef add_gaussian_noise(signal):\n    noise=np.random.normal(0,0.5,12)\n    return (signal+noise)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-10-21T20:36:16.932979Z","iopub.execute_input":"2025-10-21T20:36:16.933287Z","iopub.status.idle":"2025-10-21T20:36:16.938716Z","shell.execute_reply.started":"2025-10-21T20:36:16.933257Z","shell.execute_reply":"2025-10-21T20:36:16.937370Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"### Add a noise to the data to generalize train (=lead)","metadata":{}},{"cell_type":"code","source":"#By Gregoire DC https://www.kaggle.com/code/gregoiredc/arrhythmia-on-ecg-classification-using-cnn/notebook\n\ntempo=c.iloc[0:11]\nbruiter=add_gaussian_noise(tempo)\n\nplt.subplot(2,1,1)\nplt.plot(c.iloc[0:11])\n\nplt.subplot(2,1,2)\nplt.plot(bruiter)\n\nplt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-10-21T20:36:21.185370Z","iopub.execute_input":"2025-10-21T20:36:21.185680Z","iopub.status.idle":"2025-10-21T20:36:21.503056Z","shell.execute_reply.started":"2025-10-21T20:36:21.185658Z","shell.execute_reply":"2025-10-21T20:36:21.501936Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"### Allegedly plotting ECG signals (and Not).","metadata":{}},{"cell_type":"code","source":"#By Shashank Pandey https://www.kaggle.com/code/shashankkkpandeyyy/biomedical-signal-analysis\n# Plot a something that it was allegedly ECG signals\nplt.figure(figsize=(15, 6))\nfor i in range(3):\n    plt.plot(lead.iloc[i, :-1], label=f'Sample {i} - Label {lead.iloc[i, -1]}')\nplt.xlabel('Time Steps')\nplt.ylabel('Amplitude')\nplt.title('Allegedly sample ECG Signals')\nplt.legend()\nplt.show()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-10-21T20:51:24.772909Z","iopub.execute_input":"2025-10-21T20:51:24.773802Z","iopub.status.idle":"2025-10-21T20:51:25.017314Z","shell.execute_reply.started":"2025-10-21T20:51:24.773771Z","shell.execute_reply":"2025-10-21T20:51:25.016385Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"## It's too much noise on a ECG. I'm Done.\n\nRead the originals below to understand what's supposed to be. ","metadata":{}},{"cell_type":"markdown","source":"#Acknowledgements:\n\nGregoire DC https://www.kaggle.com/code/gregoiredc/arrhythmia-on-ecg-classification-using-cnn/notebook\n\nShashank Pandey https://www.kaggle.com/code/shashankkkpandeyyy/biomedical-signal-analysis\n\nNicolas Mine https://www.kaggle.com/code/coni57/model-from-arxiv-1805-00794/notebook","metadata":{}},{"cell_type":"markdown","source":"## ","metadata":{}}]}