{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.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":59093,"databundleVersionId":7469972,"sourceType":"competition"}],"dockerImageVersionId":30646,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"Think-External-EEG-Dataset\n====\n\nHere are the explanations for the provided external datasets links:\n\n---\n\n## [The Bonn EEG time series download page](https://www.upf.edu/web/ntsa/downloads/-/asset_publisher/xvT6E4pczrBw/content/2001-indications-of-nonlinear-deterministic-and-finite-dimensional-structures-in-time-series-of-brain-electrical-activity-dependence-on-recording-regi)  \nA dataset of time-series data recording brain electrical activity, which has shown indications of having nonlinear and finite-dimensional structures. This dataset is utilized for evaluating and comparing various time-series analysis and machine learning algorithms. The sampling rate of the data was 173.61 Hz.\n\n## [Indications of nonlinear deterministic and finite-dimensional structures in time series of brain electrical activity: Dependence on recording region and brain state](https://www.upf.edu/documents/229517819/232450661/Andrzejak-PhysicalReviewE2001.pdf/0e9a54b8-8993-b400-743e-4d64fa29fb63)　　\nA paper discussing the potential presence of nonlinear deterministic structures in the Bonn EEG time series. This research provides insights into how patterns of brain activity may vary, offering significant findings for the fields of neuroscience and medicine.\n\n---","metadata":{}},{"cell_type":"markdown","source":"# Load dataset with cesium","metadata":{}},{"cell_type":"markdown","source":"## Import module","metadata":{}},{"cell_type":"code","source":"import numpy as np\nimport matplotlib.pyplot as plt\nimport seaborn\nfrom cesium.datasets import fetch_andrzejak","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Fetch dataset","metadata":{}},{"cell_type":"code","source":"eeg = fetch_andrzejak()\n\n# Group together classes (Z, O), (N, F), (S) as normal, interictal, ictal\neeg[\"classes\"] = eeg[\"classes\"].astype(\"U16\")  # allocate memory for longer class names\neeg[\"classes\"][np.logical_or(eeg[\"classes\"] == \"Z\", eeg[\"classes\"] == \"O\")] = \"Normal\"\neeg[\"classes\"][np.logical_or(eeg[\"classes\"] == \"N\", eeg[\"classes\"] == \"F\")] = \"Interictal\"\neeg[\"classes\"][eeg[\"classes\"] == \"S\"] = \"Ictal\"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Check data","metadata":{}},{"cell_type":"code","source":"eeg[\"classes\"].shape","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"np.array(eeg[\"times\"]).shape","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Vizulize dataset","metadata":{}},{"cell_type":"code","source":"seaborn.set()\nfig, ax = plt.subplots(1, len(np.unique(eeg[\"classes\"])), sharey=True)\nfor label, subplot in zip(np.unique(eeg[\"classes\"]), ax):\n    i = np.where(eeg[\"classes\"] == label)[0][0]\n    subplot.plot(eeg[\"times\"][i], eeg[\"measurements\"][i])\n    subplot.set(xlabel=\"time (s)\", ylabel=\"signal\", title=label)","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2024-02-05T01:54:08.974596Z","iopub.execute_input":"2024-02-05T01:54:08.974992Z","iopub.status.idle":"2024-02-05T01:54:09.815395Z","shell.execute_reply.started":"2024-02-05T01:54:08.974962Z","shell.execute_reply":"2024-02-05T01:54:09.814121Z"},"trusted":true},"execution_count":null,"outputs":[]}]}