{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.12.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":116062,"databundleVersionId":14875579,"sourceType":"competition"}],"dockerImageVersionId":31234,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"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)\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,"execution":{"iopub.status.busy":"2026-01-14T14:14:50.353832Z","iopub.execute_input":"2026-01-14T14:14:50.354578Z","iopub.status.idle":"2026-01-14T14:14:50.742713Z","shell.execute_reply.started":"2026-01-14T14:14:50.354541Z","shell.execute_reply":"2026-01-14T14:14:50.741751Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"Paden goed zetten","metadata":{}},{"cell_type":"code","source":"import os\nimport pandas as pd\nimport numpy as np\n\nDATA_DIR = \"/kaggle/input/cafa-6-protein-function-prediction\"  # pas aan als jouw map anders heet\nTRAIN_DIR = os.path.join(DATA_DIR, \"Train\")\nTEST_DIR = os.path.join(DATA_DIR, \"Test\")\n\nprint(os.listdir(DATA_DIR))\nprint(\"Train:\", os.listdir(TRAIN_DIR))\nprint(\"Test:\", os.listdir(TEST_DIR))\n\ntrain_fasta = os.path.join(TRAIN_DIR, \"train_sequences.fasta\")\ntrain_terms = os.path.join(TRAIN_DIR, \"train_terms.tsv\")\n\ntest_fasta = os.path.join(TEST_DIR, \"testsuperset.fasta\")\ntest_taxon = os.path.join(TRAIN_DIR, \"testsuperset-taxon-list.tsv\")","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-14T14:14:50.744800Z","iopub.execute_input":"2026-01-14T14:14:50.745377Z","iopub.status.idle":"2026-01-14T14:14:50.755519Z","shell.execute_reply.started":"2026-01-14T14:14:50.745343Z","shell.execute_reply":"2026-01-14T14:14:50.754364Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"FASTA inlezen(train + test)","metadata":{}},{"cell_type":"code","source":"def read_fasta(path):\n    records = []\n    with open(path, \"r\") as f:\n        pid = None\n        seq_parts = []\n        for line in f:\n            line = line.strip()\n            if not line:\n                continue\n            if line.startswith(\">\"):\n                if pid is not None:\n                    records.append((pid, \"\".join(seq_parts)))\n                header = line[1:]\n                # vaak is de eerste token een unieke ID\n                # pid = header.split()[0]\n                pid = header.split(\"|\")[1] if \"|\" in header else header.split()[0]\n                seq_parts = []\n            else:\n                seq_parts.append(line)\n        if pid is not None:\n            records.append((pid, \"\".join(seq_parts)))\n    return pd.DataFrame(records, columns=[\"protein_id\", \"sequence\"])\n\n# train_seq_path = os.path.join(DATA_DIR, \"Train/train_sequences.fasta\")\n# test_seq_path  = os.path.join(DATA_DIR, \"Test/test_sequences.fasta\")\n\ntrain_seq = read_fasta(train_fasta)\ntest_seq  = read_fasta(test_fasta)\n\ntrain_seq.head(), test_seq.head()\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-14T14:14:50.756892Z","iopub.execute_input":"2026-01-14T14:14:50.757393Z","iopub.status.idle":"2026-01-14T14:14:54.002518Z","shell.execute_reply.started":"2026-01-14T14:14:50.757341Z","shell.execute_reply":"2026-01-14T14:14:54.001598Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"train_terms_df = pd.read_csv(train_terms, sep=\"\\t\")\ntrain_terms_df = train_terms_df.rename(columns={\"EntryID\": \"protein_id\"})\nprint(train_terms_df.head())\nprint(train_terms_df.columns)\nprint(\"unique proteins in terms:\", train_terms_df[\"protein_id\"].nunique())\nprint(\"unique proteins in fasta:\", train_seq[\"protein_id\"].nunique())","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-14T14:14:54.004811Z","iopub.execute_input":"2026-01-14T14:14:54.005766Z","iopub.status.idle":"2026-01-14T14:14:54.459523Z","shell.execute_reply.started":"2026-01-14T14:14:54.005732Z","shell.execute_reply":"2026-01-14T14:14:54.458717Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"termen per protein groeperen","metadata":{}},{"cell_type":"code","source":"terms_per_protein = (\n    train_terms_df\n    .groupby(\"protein_id\")[\"term\"]\n    .apply(list)\n    .reset_index()\n)\n\ndisplay(\n    terms_per_protein[terms_per_protein[\"protein_id\"] == \"Q5W0B1\"]\n)\ndisplay(terms_per_protein.head())\nprint(terms_per_protein.shape)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-14T14:14:54.460716Z","iopub.execute_input":"2026-01-14T14:14:54.461088Z","iopub.status.idle":"2026-01-14T14:14:56.202120Z","shell.execute_reply.started":"2026-01-14T14:14:54.461035Z","shell.execute_reply":"2026-01-14T14:14:56.201305Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"plus sequentie","metadata":{}},{"cell_type":"code","source":"train_df = train_seq.merge(\n    terms_per_protein,\n    on=\"protein_id\",\n    how=\"left\"\n)\n\ntrain_df = train_df.rename(columns={\"term\": \"terms\"})\ndisplay(train_df[train_df[\"protein_id\"] == \"Q5W0B1\"])\ndisplay(train_df.head())","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-14T14:14:56.203273Z","iopub.execute_input":"2026-01-14T14:14:56.203529Z","iopub.status.idle":"2026-01-14T14:14:56.322377Z","shell.execute_reply.started":"2026-01-14T14:14:56.203504Z","shell.execute_reply":"2026-01-14T14:14:56.321390Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"print(train_df.shape)\nprint(train_df.columns)\nprint(\"n proteins:\", len(train_df))\n\n# hoeveel termen per eiwit?\ntrain_df[\"n_terms\"] = train_df[\"terms\"].apply(len)  # als je kolom 'terms' heet\nprint(train_df[\"n_terms\"].describe())\nprint(train_df.shape)\nprint(train_df[\"n_terms\"].head())\nprint(train_df.head())","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-14T14:14:56.323599Z","iopub.execute_input":"2026-01-14T14:14:56.323852Z","iopub.status.idle":"2026-01-14T14:14:56.376398Z","shell.execute_reply.started":"2026-01-14T14:14:56.323830Z","shell.execute_reply":"2026-01-14T14:14:56.375326Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"(train_df[\"n_terms\"] == 233).sum()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-14T14:14:56.377605Z","iopub.execute_input":"2026-01-14T14:14:56.377985Z","iopub.status.idle":"2026-01-14T14:14:56.389685Z","shell.execute_reply.started":"2026-01-14T14:14:56.377948Z","shell.execute_reply":"2026-01-14T14:14:56.388748Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"Tel hoe vaak elke GO-term voorkomt","metadata":{}},{"cell_type":"code","source":"from collections import Counter\n\n# alle termen uit alle eiwitten\nall_terms = []\nfor terms in train_df[\"terms\"]:\n    all_terms.extend(terms)\n\nterm_counts = Counter(all_terms)\n\nprint(\"Aantal unieke GO-termen:\", len(term_counts))\nterm_counts.most_common(10)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-14T14:14:56.390873Z","iopub.execute_input":"2026-01-14T14:14:56.391337Z","iopub.status.idle":"2026-01-14T14:14:56.542320Z","shell.execute_reply.started":"2026-01-14T14:14:56.391301Z","shell.execute_reply":"2026-01-14T14:14:56.541444Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"Kies top-K GO-termen","metadata":{}},{"cell_type":"code","source":"TOP_K = 500  # goede start\n\ntop_terms = [term for term, _ in term_counts.most_common(TOP_K)]\n\nprint(\"Voorbeeld top terms:\", top_terms[:5])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-14T14:14:56.544885Z","iopub.execute_input":"2026-01-14T14:14:56.545249Z","iopub.status.idle":"2026-01-14T14:14:56.562005Z","shell.execute_reply.started":"2026-01-14T14:14:56.545225Z","shell.execute_reply":"2026-01-14T14:14:56.561018Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"Maak een index: GO-term → kolomnummer","metadata":{}},{"cell_type":"code","source":"term_to_idx = {term: i for i, term in enumerate(top_terms)}\nprint(term_to_idx)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-14T14:14:56.563059Z","iopub.execute_input":"2026-01-14T14:14:56.563449Z","iopub.status.idle":"2026-01-14T14:14:56.580072Z","shell.execute_reply.started":"2026-01-14T14:14:56.563401Z","shell.execute_reply":"2026-01-14T14:14:56.579102Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"Bouw de label-matrix (Y)","metadata":{}},{"cell_type":"code","source":"import numpy as np\n\nN = len(train_df)\nY = np.zeros((N, TOP_K), dtype=np.int8)\n\nfor i, terms in enumerate(train_df[\"terms\"]):\n    for term in terms:\n        if term in term_to_idx:\n            Y[i, term_to_idx[term]] = 1\n\nY.shape, Y.sum()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-14T14:14:56.581617Z","iopub.execute_input":"2026-01-14T14:14:56.582159Z","iopub.status.idle":"2026-01-14T14:14:56.844196Z","shell.execute_reply.started":"2026-01-14T14:14:56.582111Z","shell.execute_reply":"2026-01-14T14:14:56.843323Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"print(Y[:5])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-14T14:14:56.845564Z","iopub.execute_input":"2026-01-14T14:14:56.845904Z","iopub.status.idle":"2026-01-14T14:14:56.851509Z","shell.execute_reply.started":"2026-01-14T14:14:56.845861Z","shell.execute_reply":"2026-01-14T14:14:56.850404Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"Sanity checks","metadata":{}},{"cell_type":"code","source":"# Hoeveel labels per eiwit (binnen top-K)?\nlabels_per_protein = Y.sum(axis=1)\n\nprint(\"Min:\", labels_per_protein.min())\nprint(\"Gemiddeld:\", labels_per_protein.mean())\nprint(\"Max:\", labels_per_protein.max())","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-14T14:14:56.852945Z","iopub.execute_input":"2026-01-14T14:14:56.853511Z","iopub.status.idle":"2026-01-14T14:14:56.900421Z","shell.execute_reply.started":"2026-01-14T14:14:56.853481Z","shell.execute_reply":"2026-01-14T14:14:56.899361Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"hoeveel eiwitten hebben 0 labels?","metadata":{}},{"cell_type":"code","source":"zero_count = (Y.sum(axis=1) == 0).sum()\nprint(\"Eiwitten met 0 labels binnen top-K:\", zero_count, \"van\", len(train_df))\nprint(\"Percentage:\", zero_count / len(train_df))","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-14T14:14:56.901750Z","iopub.execute_input":"2026-01-14T14:14:56.902077Z","iopub.status.idle":"2026-01-14T14:14:56.936587Z","shell.execute_reply.started":"2026-01-14T14:14:56.902052Z","shell.execute_reply":"2026-01-14T14:14:56.935715Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"alle eiwitten zonder label droppen","metadata":{}},{"cell_type":"code","source":"mask = Y.sum(axis=1) > 0\nX_train_filtered = train_df.loc[mask].reset_index(drop=True)\nY_filtered = Y[mask]\nprint(X_train_filtered.shape, Y_filtered.shape)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-14T14:14:56.938063Z","iopub.execute_input":"2026-01-14T14:14:56.938505Z","iopub.status.idle":"2026-01-14T14:14:57.005248Z","shell.execute_reply.started":"2026-01-14T14:14:56.938471Z","shell.execute_reply":"2026-01-14T14:14:57.004389Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"sequenties->numerieke features","metadata":{}},{"cell_type":"code","source":"AA = list(\"ACDEFGHIKLMNPQRSTVWY\")\n\ndef seq_features(seq: str):\n    seq = seq.upper()\n    L = len(seq)\n    counts = {aa: 0 for aa in AA}\n    for ch in seq:\n        if ch in counts:\n            counts[ch] += 1\n    \n    feats = {f\"freq_{aa}\": (counts[aa] / L if L > 0 else 0.0) for aa in AA}\n    feats[\"length\"] = L\n    return feats","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-14T14:14:57.006480Z","iopub.execute_input":"2026-01-14T14:14:57.007079Z","iopub.status.idle":"2026-01-14T14:14:57.013846Z","shell.execute_reply.started":"2026-01-14T14:14:57.007036Z","shell.execute_reply":"2026-01-14T14:14:57.012734Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"Maak X voor training en test","metadata":{}},{"cell_type":"code","source":"X_train = pd.DataFrame([seq_features(s) for s in train_df[\"sequence\"]])\nX_test  = pd.DataFrame([seq_features(s) for s in test_seq[\"sequence\"]])\n\nprint(\"X_train:\", X_train.shape)\nprint(\"X_test :\", X_test.shape)\ndisplay(X_train.head())","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-14T14:14:57.015305Z","iopub.execute_input":"2026-01-14T14:14:57.015648Z","iopub.status.idle":"2026-01-14T14:15:15.312306Z","shell.execute_reply.started":"2026-01-14T14:14:57.015620Z","shell.execute_reply":"2026-01-14T14:15:15.311304Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"Sanity checks","metadata":{}},{"cell_type":"code","source":"# Controle: geen NaNs?\nprint(\"NaNs in X_train:\", X_train.isna().sum().sum())\n\n# Lengtes bekijken\nprint(X_train[\"length\"].describe())","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-14T14:15:15.313531Z","iopub.execute_input":"2026-01-14T14:15:15.313883Z","iopub.status.idle":"2026-01-14T14:15:15.328021Z","shell.execute_reply.started":"2026-01-14T14:15:15.313849Z","shell.execute_reply":"2026-01-14T14:15:15.327079Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"schalen","metadata":{}},{"cell_type":"code","source":"from sklearn.preprocessing import StandardScaler\n\nscaler = StandardScaler()\nX_train_scaled = scaler.fit_transform(X_train)\nX_test_scaled  = scaler.transform(X_test)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-14T14:15:15.329278Z","iopub.execute_input":"2026-01-14T14:15:15.329632Z","iopub.status.idle":"2026-01-14T14:15:16.119547Z","shell.execute_reply.started":"2026-01-14T14:15:15.329576Z","shell.execute_reply":"2026-01-14T14:15:16.118504Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"Train/valid split","metadata":{}},{"cell_type":"code","source":"from sklearn.model_selection import train_test_split\n\nX_tr, X_val, Y_tr, Y_val = train_test_split(\n    X_train_scaled,\n    Y,\n    test_size=0.2,\n    random_state=42\n)\n\nprint(X_tr.shape, Y_tr.shape)\nprint(X_val.shape, Y_val.shape)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-14T14:15:16.121245Z","iopub.execute_input":"2026-01-14T14:15:16.121707Z","iopub.status.idle":"2026-01-14T14:15:16.309103Z","shell.execute_reply.started":"2026-01-14T14:15:16.121675Z","shell.execute_reply":"2026-01-14T14:15:16.308262Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"Model definiëren","metadata":{}},{"cell_type":"code","source":"from sklearn.linear_model import LogisticRegression\nfrom sklearn.multiclass import OneVsRestClassifier\n\nmodel = OneVsRestClassifier(\n    LogisticRegression(\n        max_iter=200,\n        n_jobs=1\n    )\n)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-14T14:15:16.310712Z","iopub.execute_input":"2026-01-14T14:15:16.311244Z","iopub.status.idle":"2026-01-14T14:15:16.562145Z","shell.execute_reply.started":"2026-01-14T14:15:16.311215Z","shell.execute_reply":"2026-01-14T14:15:16.561068Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"Model trainen","metadata":{}},{"cell_type":"code","source":"model.fit(X_tr, Y_tr)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-14T14:15:16.563234Z","iopub.execute_input":"2026-01-14T14:15:16.563642Z","iopub.status.idle":"2026-01-14T14:17:14.622187Z","shell.execute_reply.started":"2026-01-14T14:15:16.563612Z","shell.execute_reply":"2026-01-14T14:17:14.619250Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"Validatie (snelle sanity check)","metadata":{}},{"cell_type":"code","source":"from sklearn.metrics import average_precision_score\nimport numpy as np\n\nY_val_pred = model.predict_proba(X_val)\n\nap_scores = []\nfor j in range(Y.shape[1]):\n    if Y_val[:, j].sum() == 0:\n        continue\n    ap_scores.append(\n        average_precision_score(Y_val[:, j], Y_val_pred[:, j])\n    )\n\nprint(\"Mean AP over labels:\", float(np.mean(ap_scores)))","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-14T14:17:14.623219Z","iopub.execute_input":"2026-01-14T14:17:14.623523Z","iopub.status.idle":"2026-01-14T14:17:17.367846Z","shell.execute_reply.started":"2026-01-14T14:17:14.623495Z","shell.execute_reply":"2026-01-14T14:17:17.366831Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"Submission maken (van A tot Z)","metadata":{}},{"cell_type":"code","source":"model.fit(X_train_scaled, Y)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-14T14:17:17.369303Z","iopub.execute_input":"2026-01-14T14:17:17.369687Z","iopub.status.idle":"2026-01-14T14:19:32.485975Z","shell.execute_reply.started":"2026-01-14T14:17:17.369641Z","shell.execute_reply":"2026-01-14T14:19:32.485217Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"Kansvoorspellingen op testdata","metadata":{}},{"cell_type":"code","source":"P_test = model.predict_proba(X_test_scaled)\nprint(P_test.shape)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-14T14:19:32.489193Z","iopub.execute_input":"2026-01-14T14:19:32.489576Z","iopub.status.idle":"2026-01-14T14:19:40.988708Z","shell.execute_reply.started":"2026-01-14T14:19:32.489543Z","shell.execute_reply":"2026-01-14T14:19:40.987710Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"Van kansen → regels voor submission","metadata":{}},{"cell_type":"code","source":"import numpy as np\nimport pandas as pd\n\nTHRESH = 0.10              # veilige baseline\nTOP_N_PER_PROTEIN = 50     # voorkomt gigantische files\n\nrows = []\ntest_ids = test_seq[\"protein_id\"].values\n\nfor i, pid in enumerate(test_ids):\n    probs = P_test[i]\n\n    # indices gesorteerd van hoge naar lage kans\n    order = np.argsort(-probs)\n\n    n_added = 0\n    for j in order:\n        score = probs[j]\n        if score < THRESH:\n            break\n\n        rows.append((pid, top_terms[j], float(score)))\n        n_added += 1\n\n        if n_added >= TOP_N_PER_PROTEIN:\n            break\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-14T14:20:18.980970Z","iopub.execute_input":"2026-01-14T14:20:18.981334Z","iopub.status.idle":"2026-01-14T14:20:24.935721Z","shell.execute_reply.started":"2026-01-14T14:20:18.981305Z","shell.execute_reply":"2026-01-14T14:20:24.934886Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"DataFrame maken + sanity check","metadata":{}},{"cell_type":"code","source":"sub = pd.DataFrame(rows, columns=[\"protein_id\", \"term\", \"score\"])\n\nprint(sub.head())\nprint(\"Aantal regels:\", len(sub))\nprint(\"Unieke eiwitten:\", sub[\"protein_id\"].nunique())","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-14T14:20:52.176666Z","iopub.execute_input":"2026-01-14T14:20:52.177017Z","iopub.status.idle":"2026-01-14T14:20:52.484404Z","shell.execute_reply.started":"2026-01-14T14:20:52.176990Z","shell.execute_reply":"2026-01-14T14:20:52.483078Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"geen text","metadata":{}},{"cell_type":"code","source":"assert not (sub[\"term\"] == \"Text\").any()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-14T14:21:41.060792Z","iopub.execute_input":"2026-01-14T14:21:41.061187Z","iopub.status.idle":"2026-01-14T14:21:41.148775Z","shell.execute_reply.started":"2026-01-14T14:21:41.061159Z","shell.execute_reply":"2026-01-14T14:21:41.147609Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"Opslaan in exact Kaggle-format","metadata":{}},{"cell_type":"code","source":"sub.to_csv(\"submission.tsv\", sep=\"\\t\", index=False, header=False)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-01-14T14:22:19.783129Z","iopub.execute_input":"2026-01-14T14:22:19.783502Z","iopub.status.idle":"2026-01-14T14:22:22.704313Z","shell.execute_reply.started":"2026-01-14T14:22:19.783473Z","shell.execute_reply":"2026-01-14T14:22:22.703244Z"}},"outputs":[],"execution_count":null}]}