{ "cells": [ { "cell_type": "code", "execution_count": 2, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "OSWN0xQn6z8u", "outputId": "bb05c540-e196-49c3-cf7a-d2f4942abe52" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Collecting datasets\n", " Using cached datasets-3.6.0-py3-none-any.whl.metadata (19 kB)\n", "Collecting huggingface_hub\n", " Using cached huggingface_hub-0.33.0-py3-none-any.whl.metadata (14 kB)\n", "Collecting fsspec\n", " Downloading fsspec-2025.5.1-py3-none-any.whl.metadata (11 kB)\n", "Collecting filelock (from datasets)\n", " Using cached filelock-3.18.0-py3-none-any.whl.metadata (2.9 kB)\n", "Collecting numpy>=1.17 (from datasets)\n", " Using cached numpy-2.3.0-cp313-cp313-manylinux_2_28_x86_64.whl.metadata (62 kB)\n", "Collecting pyarrow>=15.0.0 (from datasets)\n", " Using cached pyarrow-20.0.0-cp313-cp313-manylinux_2_28_x86_64.whl.metadata (3.3 kB)\n", "Collecting dill<0.3.9,>=0.3.0 (from datasets)\n", " Using cached dill-0.3.8-py3-none-any.whl.metadata (10 kB)\n", "Collecting pandas (from datasets)\n", " Using cached pandas-2.3.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (91 kB)\n", "Collecting requests>=2.32.2 (from datasets)\n", " Using cached requests-2.32.4-py3-none-any.whl.metadata (4.9 kB)\n", "Collecting tqdm>=4.66.3 (from datasets)\n", " Using cached tqdm-4.67.1-py3-none-any.whl.metadata (57 kB)\n", "Collecting xxhash (from datasets)\n", " Using cached xxhash-3.5.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (12 kB)\n", "Collecting multiprocess<0.70.17 (from datasets)\n", " Using cached multiprocess-0.70.16-py312-none-any.whl.metadata (7.2 kB)\n", "Collecting fsspec\n", " Using cached fsspec-2025.3.0-py3-none-any.whl.metadata (11 kB)\n", "Requirement already satisfied: packaging in ./.venv/lib/python3.13/site-packages (from datasets) (25.0)\n", "Collecting pyyaml>=5.1 (from datasets)\n", " Using cached PyYAML-6.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (2.1 kB)\n", "Collecting aiohttp!=4.0.0a0,!=4.0.0a1 (from fsspec[http]<=2025.3.0,>=2023.1.0->datasets)\n", " Using cached aiohttp-3.12.12-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (7.6 kB)\n", "Collecting typing-extensions>=3.7.4.3 (from huggingface_hub)\n", " Using cached typing_extensions-4.14.0-py3-none-any.whl.metadata (3.0 kB)\n", "Collecting hf-xet<2.0.0,>=1.1.2 (from huggingface_hub)\n", " Using cached hf_xet-1.1.3-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (879 bytes)\n", "Collecting aiohappyeyeballs>=2.5.0 (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]<=2025.3.0,>=2023.1.0->datasets)\n", " Using cached aiohappyeyeballs-2.6.1-py3-none-any.whl.metadata (5.9 kB)\n", "Collecting aiosignal>=1.1.2 (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]<=2025.3.0,>=2023.1.0->datasets)\n", " Using cached aiosignal-1.3.2-py2.py3-none-any.whl.metadata (3.8 kB)\n", "Collecting attrs>=17.3.0 (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]<=2025.3.0,>=2023.1.0->datasets)\n", " Using cached attrs-25.3.0-py3-none-any.whl.metadata (10 kB)\n", "Collecting frozenlist>=1.1.1 (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]<=2025.3.0,>=2023.1.0->datasets)\n", " Using cached frozenlist-1.7.0-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (18 kB)\n", "Collecting multidict<7.0,>=4.5 (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]<=2025.3.0,>=2023.1.0->datasets)\n", " Using cached multidict-6.4.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (5.3 kB)\n", "Collecting propcache>=0.2.0 (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]<=2025.3.0,>=2023.1.0->datasets)\n", " Using cached propcache-0.3.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (12 kB)\n", "Collecting yarl<2.0,>=1.17.0 (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]<=2025.3.0,>=2023.1.0->datasets)\n", " Using cached yarl-1.20.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (73 kB)\n", "Collecting idna>=2.0 (from yarl<2.0,>=1.17.0->aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]<=2025.3.0,>=2023.1.0->datasets)\n", " Using cached idna-3.10-py3-none-any.whl.metadata (10 kB)\n", "Collecting charset_normalizer<4,>=2 (from requests>=2.32.2->datasets)\n", " Using cached charset_normalizer-3.4.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (35 kB)\n", "Collecting urllib3<3,>=1.21.1 (from requests>=2.32.2->datasets)\n", " Using cached urllib3-2.4.0-py3-none-any.whl.metadata (6.5 kB)\n", "Collecting certifi>=2017.4.17 (from requests>=2.32.2->datasets)\n", " Using cached certifi-2025.4.26-py3-none-any.whl.metadata (2.5 kB)\n", "Requirement already satisfied: python-dateutil>=2.8.2 in ./.venv/lib/python3.13/site-packages (from pandas->datasets) (2.9.0.post0)\n", "Collecting pytz>=2020.1 (from pandas->datasets)\n", " Using cached pytz-2025.2-py2.py3-none-any.whl.metadata (22 kB)\n", "Collecting tzdata>=2022.7 (from pandas->datasets)\n", " Using cached tzdata-2025.2-py2.py3-none-any.whl.metadata (1.4 kB)\n", "Requirement already satisfied: six>=1.5 in ./.venv/lib/python3.13/site-packages (from python-dateutil>=2.8.2->pandas->datasets) (1.17.0)\n", "Using cached datasets-3.6.0-py3-none-any.whl (491 kB)\n", "Using cached fsspec-2025.3.0-py3-none-any.whl (193 kB)\n", "Using cached dill-0.3.8-py3-none-any.whl (116 kB)\n", "Using cached multiprocess-0.70.16-py312-none-any.whl (146 kB)\n", "Using cached huggingface_hub-0.33.0-py3-none-any.whl (514 kB)\n", "Using cached hf_xet-1.1.3-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.8 MB)\n", "Using cached aiohttp-3.12.12-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.7 MB)\n", "Using cached multidict-6.4.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (222 kB)\n", "Using cached yarl-1.20.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (352 kB)\n", "Using cached aiohappyeyeballs-2.6.1-py3-none-any.whl (15 kB)\n", "Using cached aiosignal-1.3.2-py2.py3-none-any.whl (7.6 kB)\n", "Using cached attrs-25.3.0-py3-none-any.whl (63 kB)\n", "Using cached frozenlist-1.7.0-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (232 kB)\n", "Using cached idna-3.10-py3-none-any.whl (70 kB)\n", "Using cached numpy-2.3.0-cp313-cp313-manylinux_2_28_x86_64.whl (16.6 MB)\n", "Using cached propcache-0.3.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (206 kB)\n", "Using cached pyarrow-20.0.0-cp313-cp313-manylinux_2_28_x86_64.whl (42.3 MB)\n", "Using cached PyYAML-6.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (759 kB)\n", "Using cached requests-2.32.4-py3-none-any.whl (64 kB)\n", "Using cached charset_normalizer-3.4.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (148 kB)\n", "Using cached urllib3-2.4.0-py3-none-any.whl (128 kB)\n", "Using cached certifi-2025.4.26-py3-none-any.whl (159 kB)\n", "Using cached tqdm-4.67.1-py3-none-any.whl (78 kB)\n", "Using cached typing_extensions-4.14.0-py3-none-any.whl (43 kB)\n", "Using cached filelock-3.18.0-py3-none-any.whl (16 kB)\n", "Using cached pandas-2.3.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.0 MB)\n", "Using cached pytz-2025.2-py2.py3-none-any.whl (509 kB)\n", "Using cached tzdata-2025.2-py2.py3-none-any.whl (347 kB)\n", "Using cached xxhash-3.5.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (194 kB)\n", "Installing collected packages: pytz, xxhash, urllib3, tzdata, typing-extensions, tqdm, pyyaml, pyarrow, propcache, numpy, multidict, idna, hf-xet, fsspec, frozenlist, filelock, dill, charset_normalizer, certifi, attrs, aiohappyeyeballs, yarl, requests, pandas, multiprocess, aiosignal, huggingface_hub, aiohttp, datasets\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m29/29\u001b[0m [datasets]/29\u001b[0m [datasets]ce_hub]]\n", "\u001b[1A\u001b[2KSuccessfully installed aiohappyeyeballs-2.6.1 aiohttp-3.12.12 aiosignal-1.3.2 attrs-25.3.0 certifi-2025.4.26 charset_normalizer-3.4.2 datasets-3.6.0 dill-0.3.8 filelock-3.18.0 frozenlist-1.7.0 fsspec-2025.3.0 hf-xet-1.1.3 huggingface_hub-0.33.0 idna-3.10 multidict-6.4.4 multiprocess-0.70.16 numpy-2.3.0 pandas-2.3.0 propcache-0.3.2 pyarrow-20.0.0 pytz-2025.2 pyyaml-6.0.2 requests-2.32.4 tqdm-4.67.1 typing-extensions-4.14.0 tzdata-2025.2 urllib3-2.4.0 xxhash-3.5.0 yarl-1.20.1\n" ] } ], "source": [ "!pip install -U datasets huggingface_hub fsspec" ] }, { "cell_type": "markdown", "metadata": { "id": "edF1DuNE6nSg" }, "source": [ "### 📥 Step 1: Preprocess the Data\n", "\n", "Since the dataset is hosted on Hugging Face, you can load it directly using the `load_dataset` function." ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "id": "HmHDx6cU7WRG" }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/escher/Projects/OpenPsychometrics/2018-11-08-IPIP-FFM-data/2018-11-08-OpenPsychometrics-IPIP-FFM/.venv/lib/python3.13/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", " from .autonotebook import tqdm as notebook_tqdm\n", "Generating train split: 100%|██████████| 609204/609204 [00:00<00:00, 781185.05 examples/s]\n", "Generating validation split: 100%|██████████| 203068/203068 [00:00<00:00, 842451.01 examples/s]\n", "Generating test split: 100%|██████████| 203069/203069 [00:00<00:00, 769756.37 examples/s]\n" ] }, { "data": { "text/html": [ "
\n", " | EXT1 | \n", "EXT2 | \n", "EXT3 | \n", "EXT4 | \n", "EXT5 | \n", "EXT6 | \n", "EXT7 | \n", "EXT8 | \n", "EXT9 | \n", "EXT10 | \n", "... | \n", "screenw | \n", "screenh | \n", "introelapse | \n", "testelapse | \n", "endelapse | \n", "IPC | \n", "country | \n", "lat_appx_lots_of_err | \n", "long_appx_lots_of_err | \n", "__index_level_0__ | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "2.0 | \n", "2.0 | \n", "5.0 | \n", "4.0 | \n", "4.0 | \n", "1.0 | \n", "2.0 | \n", "4.0 | \n", "4.0 | \n", "2.0 | \n", "... | \n", "1324.0 | \n", "745.0 | \n", "7.0 | \n", "2872.0 | \n", "17 | \n", "1 | \n", "US | \n", "38.0 | \n", "-97.0 | \n", "422981 | \n", "
1 | \n", "2.0 | \n", "5.0 | \n", "5.0 | \n", "5.0 | \n", "2.0 | \n", "5.0 | \n", "2.0 | \n", "5.0 | \n", "3.0 | \n", "5.0 | \n", "... | \n", "1366.0 | \n", "768.0 | \n", "70.0 | \n", "223.0 | \n", "18 | \n", "47 | \n", "US | \n", "38.0 | \n", "-97.0 | \n", "325363 | \n", "
2 | \n", "3.0 | \n", "3.0 | \n", "5.0 | \n", "1.0 | \n", "5.0 | \n", "1.0 | \n", "5.0 | \n", "5.0 | \n", "3.0 | \n", "4.0 | \n", "... | \n", "1920.0 | \n", "1080.0 | \n", "30.0 | \n", "207.0 | \n", "10 | \n", "1 | \n", "US | \n", "42.8886 | \n", "-88.0384 | \n", "105821 | \n", "
3 | \n", "1.0 | \n", "5.0 | \n", "3.0 | \n", "5.0 | \n", "2.0 | \n", "4.0 | \n", "3.0 | \n", "5.0 | \n", "1.0 | \n", "5.0 | \n", "... | \n", "1440.0 | \n", "960.0 | \n", "4.0 | \n", "166.0 | \n", "10 | \n", "1 | \n", "AU | \n", "-37.7919 | \n", "145.084 | \n", "169213 | \n", "
4 | \n", "4.0 | \n", "3.0 | \n", "3.0 | \n", "3.0 | \n", "3.0 | \n", "2.0 | \n", "4.0 | \n", "3.0 | \n", "2.0 | \n", "3.0 | \n", "... | \n", "1920.0 | \n", "1200.0 | \n", "12.0 | \n", "194.0 | \n", "4 | \n", "2 | \n", "US | \n", "37.5402 | \n", "-122.3041 | \n", "839500 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
609199 | \n", "1.0 | \n", "5.0 | \n", "1.0 | \n", "5.0 | \n", "1.0 | \n", "5.0 | \n", "1.0 | \n", "5.0 | \n", "1.0 | \n", "5.0 | \n", "... | \n", "360.0 | \n", "640.0 | \n", "6.0 | \n", "364.0 | \n", "12 | \n", "1 | \n", "US | \n", "38.0 | \n", "-97.0 | \n", "259178 | \n", "
609200 | \n", "4.0 | \n", "1.0 | \n", "4.0 | \n", "3.0 | \n", "4.0 | \n", "0.0 | \n", "5.0 | \n", "2.0 | \n", "4.0 | \n", "2.0 | \n", "... | \n", "360.0 | \n", "640.0 | \n", "15.0 | \n", "180.0 | \n", "17 | \n", "1 | \n", "CR | \n", "9.8533 | \n", "-83.9023 | \n", "365838 | \n", "
609201 | \n", "4.0 | \n", "2.0 | \n", "3.0 | \n", "2.0 | \n", "5.0 | \n", "1.0 | \n", "4.0 | \n", "2.0 | \n", "5.0 | \n", "2.0 | \n", "... | \n", "400.0 | \n", "640.0 | \n", "24.0 | \n", "519.0 | \n", "392 | \n", "6 | \n", "US | \n", "38.0 | \n", "-97.0 | \n", "131932 | \n", "
609202 | \n", "1.0 | \n", "4.0 | \n", "3.0 | \n", "3.0 | \n", "2.0 | \n", "4.0 | \n", "2.0 | \n", "4.0 | \n", "2.0 | \n", "5.0 | \n", "... | \n", "1368.0 | \n", "912.0 | \n", "217.0 | \n", "209.0 | \n", "17 | \n", "2 | \n", "US | \n", "38.0 | \n", "-97.0 | \n", "671155 | \n", "
609203 | \n", "4.0 | \n", "2.0 | \n", "2.0 | \n", "3.0 | \n", "2.0 | \n", "1.0 | \n", "2.0 | \n", "5.0 | \n", "3.0 | \n", "5.0 | \n", "... | \n", "1366.0 | \n", "768.0 | \n", "11.0 | \n", "203.0 | \n", "12 | \n", "1 | \n", "CA | \n", "45.9784 | \n", "-66.6905 | \n", "121958 | \n", "
609204 rows × 111 columns
\n", "