From 1471ed92307081d9ead4de4838ee942d215faa11 Mon Sep 17 00:00:00 2001 From: Worldsoldure00 Date: Mon, 6 Apr 2026 21:48:08 -0400 Subject: [PATCH] fixes: tsfresh_example.ipynb --- tutorials/tsfresh/requirements.txt | 2 +- tutorials/tsfresh/tsfresh_example.ipynb | 59 +++++++++++++++---------- 2 files changed, 37 insertions(+), 24 deletions(-) diff --git a/tutorials/tsfresh/requirements.txt b/tutorials/tsfresh/requirements.txt index 2fcd641d6..02840511b 100644 --- a/tutorials/tsfresh/requirements.txt +++ b/tutorials/tsfresh/requirements.txt @@ -7,7 +7,7 @@ ipykernel==6.29.5 numpy==1.26.4 pandas==2.2.3 matplotlib==3.9.4 -scipy==1.13.1 +scipy>=1.14.0 # tsfresh. tsfresh==0.20.3 diff --git a/tutorials/tsfresh/tsfresh_example.ipynb b/tutorials/tsfresh/tsfresh_example.ipynb index 7122ae685..e61fcc221 100644 --- a/tutorials/tsfresh/tsfresh_example.ipynb +++ b/tutorials/tsfresh/tsfresh_example.ipynb @@ -68,7 +68,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "id": "3aa7ce61", "metadata": { "id": "3aa7ce61", @@ -92,53 +92,56 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "id": "17e69980", "metadata": { "id": "17e69980", "lines_to_next_cell": 2 }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Dataset ready at: uci_har_data/UCI HAR Dataset\n" + ] + } + ], "source": [ - "import pathlib.Path as path\n", + "from pathlib import Path\n", "import zipfile\n", - "\n", "import numpy as np\n", "import requests\n", - "import tqdm.tqdm as tq_vis\n", + "from tqdm import tqdm\n", "\n", "np.random.seed(42)\n", "\n", "DATA_URL = \"https://archive.ics.uci.edu/ml/machine-learning-databases/00240/UCI%20HAR%20Dataset.zip\"\n", - "DATA_DIR = path(\"./uci_har_data\")\n", - "\n", - "\n", - "# ## 2) Download the UCI HAR dataset\n", - "#\n", - "# If the dataset hasn't been downloaded, this function will download it.\n", - "\n", + "DATA_DIR = Path(\"./uci_har_data\") # ✅ corrected here\n", "\n", "def fetch_data(url=DATA_URL, out_dir=DATA_DIR):\n", " out_dir.mkdir(parents=True, exist_ok=True)\n", " zip_path = out_dir / \"UCI_HAR_Dataset.zip\"\n", + "\n", " if not zip_path.exists():\n", " resp = requests.get(url, stream=True, timeout=20)\n", " resp.raise_for_status()\n", " total = int(resp.headers.get(\"content-length\", 0))\n", - " with (\n", - " open(zip_path, \"wb\") as f,\n", - " tq_vis(total=total, unit=\"B\", unit_scale=True) as pbar,\n", - " ):\n", + " with open(zip_path, \"wb\") as f, tqdm(total=total, unit=\"B\", unit_scale=True, desc=\"Downloading\") as pbar:\n", " for chunk in resp.iter_content(chunk_size=8192):\n", " if chunk:\n", " f.write(chunk)\n", " pbar.update(len(chunk))\n", - " with zipfile.ZipFile(zip_path, \"r\") as zf:\n", - " zf.extractall(out_dir)\n", - " return out_dir / \"UCI HAR Dataset\"\n", "\n", + " extract_path = out_dir / \"UCI HAR Dataset\"\n", + " if not extract_path.exists():\n", + " with zipfile.ZipFile(zip_path, \"r\") as zf:\n", + " zf.extractall(out_dir)\n", "\n", - "har_root = fetch_data()" + " return extract_path\n", + "\n", + "har_root = fetch_data()\n", + "print(f\"Dataset ready at: {har_root}\")" ] }, { @@ -435,11 +438,21 @@ "main_language": "python" }, "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", + "language": "python", "name": "python3" }, "language_info": { - "name": "python" + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.13" } }, "nbformat": 4,