From 3f65734a20590a494ec8990c951d9724b96f9b1d Mon Sep 17 00:00:00 2001 From: Supravisor <153783117+Supravisor@users.noreply.github.com> Date: Fri, 2 Oct 2026 03:27:39 +0000 Subject: [PATCH] Keep only the 10 core features used by TensorFlow tutorials --- datasets/Titanic.ipynb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/datasets/Titanic.ipynb b/datasets/Titanic.ipynb index a70c61e..0bd2531 100644 --- a/datasets/Titanic.ipynb +++ b/datasets/Titanic.ipynb @@ -10,7 +10,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 6, "id": "ecd595e6-4de0-45f1-8022-92ad3c47e540", "metadata": {}, "outputs": [ @@ -45,7 +45,11 @@ "df['class'] = df['class'].map({1: 'First', 2: 'Second', 3: 'Third'})\n", "df['deck'] = df['Cabin'].dropna().astype(str).str[0].reindex(df.index, fill_value='unknown')\n", "df['embark_town'] = df['embark_town'].map({'S': 'Southampton', 'C': 'Cherbourg', 'Q': 'Queenstown'}).fillna('unknown')\n", - "df['alone'] = np.where((df['n_siblings_spouses'] == 0) & (df['parch'] == 0), 'y', 'n')" + "df['alone'] = np.where((df['n_siblings_spouses'] == 0) & (df['parch'] == 0), 'y', 'n')\n", + "\n", + "# Keep only the 10 core features used by TensorFlow tutorials\n", + "final_features = ['survived', 'sex', 'age', 'n_siblings_spouses', 'parch', 'fare', 'class', 'deck', 'embark_town', 'alone']\n", + "processed_df = df[final_features].dropna(subset=['age', 'fare']).reset_index(drop=True)" ] }, {