Files
Valar-Morgulis/notebooks/asoiaf_mortality.ipynb
T

10887 lines
766 KiB
Plaintext
Raw Normal View History

2026-09-01 09:02:03 +03:00
{
"cells": [
{
"cell_type": "markdown",
"id": "b6c0e9a1",
"metadata": {},
"source": [
"# Прогноз смертности персонажей\n",
"\n",
"Загрузим данные и кратко проверим их размер, состав признаков и наличие пропусков."
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "c8a7b40b",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>S.No</th>\n",
" <th>actual</th>\n",
" <th>pred</th>\n",
" <th>alive</th>\n",
" <th>plod</th>\n",
" <th>name</th>\n",
" <th>title</th>\n",
" <th>male</th>\n",
" <th>culture</th>\n",
" <th>dateOfBirth</th>\n",
" <th>...</th>\n",
" <th>isAliveHeir</th>\n",
" <th>isAliveSpouse</th>\n",
" <th>isMarried</th>\n",
" <th>isNoble</th>\n",
" <th>age</th>\n",
" <th>numDeadRelations</th>\n",
" <th>boolDeadRelations</th>\n",
" <th>isPopular</th>\n",
" <th>popularity</th>\n",
" <th>isAlive</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0.054</td>\n",
" <td>0.946</td>\n",
" <td>Viserys II Targaryen</td>\n",
" <td>NaN</td>\n",
" <td>1</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>...</td>\n",
" <td>0.0</td>\n",
" <td>NaN</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>NaN</td>\n",
" <td>11</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>0.605351</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>2</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>0.387</td>\n",
" <td>0.613</td>\n",
" <td>Walder Frey</td>\n",
" <td>Lord of the Crossing</td>\n",
" <td>1</td>\n",
" <td>Rivermen</td>\n",
" <td>208.0</td>\n",
" <td>...</td>\n",
" <td>NaN</td>\n",
" <td>1.0</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>97.0</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>0.896321</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>3</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" <td>0.493</td>\n",
" <td>0.507</td>\n",
" <td>Addison Hill</td>\n",
" <td>Ser</td>\n",
" <td>1</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>...</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>NaN</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0.267559</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>4</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0.076</td>\n",
" <td>0.924</td>\n",
" <td>Aemma Arryn</td>\n",
" <td>Queen</td>\n",
" <td>0</td>\n",
" <td>NaN</td>\n",
" <td>82.0</td>\n",
" <td>...</td>\n",
" <td>NaN</td>\n",
" <td>0.0</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>23.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0.183946</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>5</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>0.617</td>\n",
" <td>0.383</td>\n",
" <td>Sylva Santagar</td>\n",
" <td>Greenstone</td>\n",
" <td>0</td>\n",
" <td>Dornish</td>\n",
" <td>276.0</td>\n",
" <td>...</td>\n",
" <td>NaN</td>\n",
" <td>1.0</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>29.0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0.043478</td>\n",
" <td>1</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>5 rows × 33 columns</p>\n",
"</div>"
],
"text/plain": [
" S.No actual pred alive plod name \\\n",
"0 1 0 0 0.054 0.946 Viserys II Targaryen \n",
"1 2 1 0 0.387 0.613 Walder Frey \n",
"2 3 1 0 0.493 0.507 Addison Hill \n",
"3 4 0 0 0.076 0.924 Aemma Arryn \n",
"4 5 1 1 0.617 0.383 Sylva Santagar \n",
"\n",
" title male culture dateOfBirth ... isAliveHeir \\\n",
"0 NaN 1 NaN NaN ... 0.0 \n",
"1 Lord of the Crossing 1 Rivermen 208.0 ... NaN \n",
"2 Ser 1 NaN NaN ... NaN \n",
"3 Queen 0 NaN 82.0 ... NaN \n",
"4 Greenstone 0 Dornish 276.0 ... NaN \n",
"\n",
" isAliveSpouse isMarried isNoble age numDeadRelations boolDeadRelations \\\n",
"0 NaN 0 0 NaN 11 1 \n",
"1 1.0 1 1 97.0 1 1 \n",
"2 NaN 0 1 NaN 0 0 \n",
"3 0.0 1 1 23.0 0 0 \n",
"4 1.0 1 1 29.0 0 0 \n",
"\n",
" isPopular popularity isAlive \n",
"0 1 0.605351 0 \n",
"1 1 0.896321 1 \n",
"2 0 0.267559 1 \n",
"3 0 0.183946 0 \n",
"4 0 0.043478 1 \n",
"\n",
"[5 rows x 33 columns]"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import pandas as pd\n",
"\n",
"df = pd.read_csv('../data/character-predictions.csv')\n",
"df.head()"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "cac21678",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(1946, 33)"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.shape"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "673e8cf2",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Index(['S.No', 'actual', 'pred', 'alive', 'plod', 'name', 'title', 'male',\n",
" 'culture', 'dateOfBirth', 'DateoFdeath', 'mother', 'father', 'heir',\n",
" 'house', 'spouse', 'book1', 'book2', 'book3', 'book4', 'book5',\n",
" 'isAliveMother', 'isAliveFather', 'isAliveHeir', 'isAliveSpouse',\n",
" 'isMarried', 'isNoble', 'age', 'numDeadRelations', 'boolDeadRelations',\n",
" 'isPopular', 'popularity', 'isAlive'],\n",
" dtype='str')"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.columns"
]
},
{
"cell_type": "markdown",
"id": "8f0ca912",
"metadata": {},
"source": [
"`S.No` - порядковый номер строки \n",
"\n",
"`actual` - фактический статус персонажа: 1 — жив, 0 — мёртв\n",
"\n",
"`pred` - предсказанный другой моделью статус персонажа\n",
"\n",
"`alive` - предсказанная другой моделью вероятность того, что персонаж жив\n",
"\n",
"`plod` - предсказанная другой моделью вероятность смерти персонажа\n",
"\n",
"`name` - имя персонажа\n",
"\n",
"`title` - титул персонажа\n",
"\n",
"`male` - пол персонажа: 1 — мужчина, 0 — женщина\n",
"\n",
"`culture` - культура или происхождение персонажа\n",
"\n",
"`dateOfBirth` - год рождения персонажа\n",
"\n",
"`DateoFdeath` - год смерти персонажа\n",
"\n",
"`mother` - имя матери персонажа\n",
"\n",
"`father` - имя отца персонажа\n",
"\n",
"`heir` - наследник персонажа\n",
"\n",
"`house` - дом, семья или организация персонажа\n",
"\n",
"`spouse` - супруг или супруга персонажа\n",
"\n",
"`book1` - появляется ли персонаж в книге *A Game of Thrones*\n",
"\n",
"`book2` - появляется ли персонаж в книге *A Clash of Kings*\n",
"\n",
"`book3` - появляется ли персонаж в книге *A Storm of Swords*\n",
"\n",
"`book4` - появляется ли персонаж в книге *A Feast for Crows*\n",
"\n",
"`book5` - появляется ли персонаж в книге *A Dance with Dragons*\n",
"\n",
"`isAliveMother` - жива ли мать персонажа\n",
"\n",
"`isAliveFather` - жив ли отец персонажа\n",
"\n",
"`isAliveHeir` - жив ли наследник персонажа\n",
"\n",
"`isAliveSpouse` - жив ли супруг или супруга персонажа\n",
"\n",
"`isMarried` - состоит ли персонаж в браке\n",
"\n",
"`isNoble` - является ли персонаж представителем знати\n",
"\n",
"`age` - возраст персонажа\n",
"\n",
"`numDeadRelations` - количество умерших родственников персонажа\n",
"\n",
"`boolDeadRelations` - есть ли у персонажа хотя бы один умерший родственник\n",
"\n",
"`isPopular` - считается ли персонаж популярным\n",
"\n",
"`popularity` - числовой показатель популярности персонажа от 0 до 1\n",
"\n",
"`isAlive` - фактический финальный статус персонажа: 1 — жив, 0 — мёртв\n"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "4bbd4dea",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'pandas.DataFrame'>\n",
"RangeIndex: 1946 entries, 0 to 1945\n",
"Data columns (total 33 columns):\n",
" # Column Non-Null Count Dtype \n",
"--- ------ -------------- ----- \n",
" 0 S.No 1946 non-null int64 \n",
" 1 actual 1946 non-null int64 \n",
" 2 pred 1946 non-null int64 \n",
" 3 alive 1946 non-null float64\n",
" 4 plod 1946 non-null float64\n",
" 5 name 1946 non-null str \n",
" 6 title 938 non-null str \n",
" 7 male 1946 non-null int64 \n",
" 8 culture 677 non-null str \n",
" 9 dateOfBirth 433 non-null float64\n",
" 10 DateoFdeath 444 non-null float64\n",
" 11 mother 21 non-null str \n",
" 12 father 26 non-null str \n",
" 13 heir 23 non-null str \n",
" 14 house 1519 non-null str \n",
" 15 spouse 276 non-null str \n",
" 16 book1 1946 non-null int64 \n",
" 17 book2 1946 non-null int64 \n",
" 18 book3 1946 non-null int64 \n",
" 19 book4 1946 non-null int64 \n",
" 20 book5 1946 non-null int64 \n",
" 21 isAliveMother 21 non-null float64\n",
" 22 isAliveFather 26 non-null float64\n",
" 23 isAliveHeir 23 non-null float64\n",
" 24 isAliveSpouse 276 non-null float64\n",
" 25 isMarried 1946 non-null int64 \n",
" 26 isNoble 1946 non-null int64 \n",
" 27 age 433 non-null float64\n",
" 28 numDeadRelations 1946 non-null int64 \n",
" 29 boolDeadRelations 1946 non-null int64 \n",
" 30 isPopular 1946 non-null int64 \n",
" 31 popularity 1946 non-null float64\n",
" 32 isAlive 1946 non-null int64 \n",
"dtypes: float64(10), int64(15), str(8)\n",
"memory usage: 501.8 KB\n"
]
}
],
"source": [
"df.info()"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "77b8f02b",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"S.No 0\n",
"actual 0\n",
"pred 0\n",
"alive 0\n",
"plod 0\n",
"name 0\n",
"title 1008\n",
"male 0\n",
"culture 1269\n",
"dateOfBirth 1513\n",
"DateoFdeath 1502\n",
"mother 1925\n",
"father 1920\n",
"heir 1923\n",
"house 427\n",
"spouse 1670\n",
"book1 0\n",
"book2 0\n",
"book3 0\n",
"book4 0\n",
"book5 0\n",
"isAliveMother 1925\n",
"isAliveFather 1920\n",
"isAliveHeir 1923\n",
"isAliveSpouse 1670\n",
"isMarried 0\n",
"isNoble 0\n",
"age 1513\n",
"numDeadRelations 0\n",
"boolDeadRelations 0\n",
"isPopular 0\n",
"popularity 0\n",
"isAlive 0\n",
"dtype: int64"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.isna().sum()"
]
},
{
"cell_type": "markdown",
"id": "a23f1c48",
"metadata": {},
"source": [
"В выборке 1946 персонажей и 33 исходных признака. Часть столбцов заполнена полностью, но сведения о родственниках, супруге, возрасте и происхождении часто отсутствуют — это нужно учесть при отборе признаков и предобработке."
]
},
{
"cell_type": "markdown",
"id": "ca61b97a",
"metadata": {},
"source": [
"# Целевая переменная\n",
"\n",
"Создадим столбец `death`, показывающий, умер ли персонаж в книгах. Это и будет целевой переменной."
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "4c966bb6",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"death\n",
"0 74.563207\n",
"1 25.436793\n",
"Name: proportion, dtype: float64"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df['death'] = 1 - df['actual']\n",
"\n",
"df['death'].value_counts(normalize=True) * 100"
]
},
{
"cell_type": "markdown",
"id": "8d14e3b7",
"metadata": {},
"source": [
"Около 25% персонажей относятся к классу «умер», поэтому классы несбалансированы. "
]
},
{
"cell_type": "markdown",
"id": "3d0008e5",
"metadata": {},
"source": [
"Проверим преобразование целевой переменной на примере Джона Сноу."
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "92fdea76",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>name</th>\n",
" <th>actual</th>\n",
" <th>death</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>1749</th>\n",
" <td>Jon Snow</td>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" name actual death\n",
"1749 Jon Snow 1 0"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.loc[\n",
" df['name'] == 'Jon Snow', ['name', 'actual', 'death']\n",
"]"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "86892ad4",
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkQAAAHmCAYAAACS3JEiAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjgsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvwVt1zgAAAAlwSFlzAAAPYQAAD2EBqD+naQAAQa9JREFUeJzt3QmcjeX///HPWGbGOmMwxjK2yK5EaayJ7CRUIiRRsiTK8i1ENIyyZolvoRKVUKnIUpQ9kiVE2cUoZmzZZs7/8bm+v/v858yMZXTOnDPnfj0fj7sz5z73nHOde840b9f1ua47wOFwOAQAAMDGMnm7AQAAAN5GIAIAALZHIAIAALZHIAIAALZHIAIAALZHIAIAALZHIAIAALZHIAIAALZHIAIAALZHIAIAALZHIALSwezZsyUgIMC5BQcHy5133im9evWSkydP8jMAAC/L4u0GAHYyYsQIKVGihFy6dEl+/PFHmTZtmnz99deyc+dOyZ49u7ebBwC2RSAC0lGTJk2kWrVq5utnnnlG8ubNK+PGjZPPP/9cnnjiCX4WAOAlDJkBXvTggw+a2wMHDpjb06dPy0svvSSVKlWSnDlzSu7cuU2I+uWXX1J8r/Yyvfbaa2boTYfgChYsKK1bt5bff//dPH7w4EGXYbrk2wMPPOB8ru+//97s+/jjj+U///mPRERESI4cOaRly5Zy5MiRFK+9ceNGady4sYSEhJierbp168ratWtTfY/6Oqm9vrY9uQ8//FCqVq0q2bJlk7CwMGnXrl2qr3+j95ZUYmKiTJgwQSpUqGDOUYECBeTZZ5+VM2fOuBxXvHhxad68eYrX0SHN5M+ZWtvHjh2b4pyqy5cvy7Bhw6RUqVISFBQkkZGRMmDAALP/Rq53zlJ7n7NmzTKfo/DwcPMa5cuXNz2PyVnv8dtvv5W7777bnA89duHChTcc3k26HT161Hncnj17pG3btubnpM+lQf+LL764peexNj1G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P50coD1EQ4cOve5nEfA0aogAH6K9I/+r23WtRUlek9GmTRszFKU9GMkl//60eP/9901dSNKApj08OqtMaf2N/qF/8803zWyx5HRmWPK263tKbUp7UrpcgB6nfxSTt1/vJ51+fe3aNVNDpb1tNxoy014HHXLUnrbk9DmsYbfbocNT2nM0evTo64YdfX39uc2cOTPFY//884+pu/q3rN60pOdMh5h09lhqjh8/7jIT7+zZs+ZnrsHuVobLlPa66bIAOvtRPxs3+wzczntQOsMRSE/0EAE+RIODTnfW6cc6JVmnaeuQj/WvcosWwuofsn79+smmTZvMdGz9A6s9Ijrl+uGHH76t19chulq1apnX1yn/+kdJhz+6detmHtfhu//+978mIOlUbz1Oa0X0D7/2SmjPkfZaaFu0XmrSpEmmx0fXObJYQUrXntFgERUVZUKWDldpr4vWsuj0bS3u1joq/QOuU851iEbfnw4p6vfq69yIFhZrbY9Oiddi8IYNG5peDe150KCmtVpaNH47tN5IhwFv1EPSsWNHMxVdp7jrudGeKg1oun6P7l+2bNlNe85uRt+TDpG1aNHCvFc9txrANLSkFlb0Z9G1a1fZvHmzqWF77733zM/5egHqevRnq58THRLUz4Z+PvV59OepaxWltm7W9ehnRqfox8TEmN5E/Tzp+bXW5gLSjVvnrAFI1a1MZVY6jbl///5mKrROx69Zs6Zj/fr1qU5Z1qnKr7zyipnunjVrVkdERISjbdu2jt9///22p93rVOfBgwebaeT6+joV/dChQym+/+eff3a0bt3aLBugSwLolO7HHnvMsXLlSpfXvtnWuXNnl+fVKeG1atVy5MiRw2xly5Y
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import matplotlib.pyplot as plt\n",
"\n",
"df['death'].value_counts().plot(kind='bar')\n",
"\n",
"plt.title('Распределение таргета')\n",
"plt.xticks([0, 1], ['Жив', 'Мертв'])\n",
"plt.xlabel('Статус')\n",
"plt.ylabel('Количество персонажей')\n",
"\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"id": "da52625f",
"metadata": {},
"source": [
"# Отбор признаков"
]
},
{
"cell_type": "markdown",
"id": "4f55720e",
"metadata": {},
"source": [
"Не используем признаки, напрямую раскрывающие исход (`actual`, `isAlive`, `DateoFdeath`) или уже содержащие прогноз другой модели (`pred`, `alive`, `plod`). Также исключим индикаторы `book1`–`book5`, чтобы модель не опиралась на появление персонажа в конкретной части истории."
]
},
{
"cell_type": "markdown",
"id": "7566c97f",
"metadata": {},
"source": [
"Посмотрим на долю пропусков по столбцам. Признаки, в которых отсутствует больше 80% значений, использовать не будем."
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "1c50ac39",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"isAliveMother 0.989209\n",
"mother 0.989209\n",
"isAliveHeir 0.988181\n",
"heir 0.988181\n",
"father 0.986639\n",
"isAliveFather 0.986639\n",
"isAliveSpouse 0.858171\n",
"spouse 0.858171\n",
"dateOfBirth 0.777492\n",
"age 0.777492\n",
"DateoFdeath 0.771840\n",
"culture 0.652107\n",
"title 0.517986\n",
"house 0.219424\n",
"actual 0.000000\n",
"S.No 0.000000\n",
"plod 0.000000\n",
"male 0.000000\n",
"book2 0.000000\n",
"book1 0.000000\n",
"alive 0.000000\n",
"pred 0.000000\n",
"name 0.000000\n",
"book5 0.000000\n",
"book3 0.000000\n",
"book4 0.000000\n",
"isMarried 0.000000\n",
"isNoble 0.000000\n",
"numDeadRelations 0.000000\n",
"boolDeadRelations 0.000000\n",
"isPopular 0.000000\n",
"popularity 0.000000\n",
"isAlive 0.000000\n",
"death 0.000000\n",
"dtype: float64"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.isna().mean().sort_values(ascending=False)"
]
},
{
"cell_type": "markdown",
"id": "934a842a",
"metadata": {},
"source": [
"В итоге выберем следующие признаки:"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "7a6474aa",
"metadata": {},
"outputs": [],
"source": [
"features = [\n",
" \"title\",\n",
" \"male\",\n",
" \"culture\",\n",
" \"house\",\n",
" \"isMarried\",\n",
" \"isNoble\",\n",
" \"age\",\n",
" \"numDeadRelations\",\n",
" \"popularity\"\n",
"]\n",
"\n",
"X = df[features].copy()\n",
"y = df[\"death\"].copy()"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "b8774348",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>title</th>\n",
" <th>male</th>\n",
" <th>culture</th>\n",
" <th>house</th>\n",
" <th>isMarried</th>\n",
" <th>isNoble</th>\n",
" <th>age</th>\n",
" <th>numDeadRelations</th>\n",
" <th>popularity</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>NaN</td>\n",
" <td>1</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>NaN</td>\n",
" <td>11</td>\n",
" <td>0.605351</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Lord of the Crossing</td>\n",
" <td>1</td>\n",
" <td>Rivermen</td>\n",
" <td>House Frey</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>97.0</td>\n",
" <td>1</td>\n",
" <td>0.896321</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Ser</td>\n",
" <td>1</td>\n",
" <td>NaN</td>\n",
" <td>House Swyft</td>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>NaN</td>\n",
" <td>0</td>\n",
" <td>0.267559</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Queen</td>\n",
" <td>0</td>\n",
" <td>NaN</td>\n",
" <td>House Arryn</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>23.0</td>\n",
" <td>0</td>\n",
" <td>0.183946</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Greenstone</td>\n",
" <td>0</td>\n",
" <td>Dornish</td>\n",
" <td>House Santagar</td>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" <td>29.0</td>\n",
" <td>0</td>\n",
" <td>0.043478</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" title male culture house isMarried isNoble \\\n",
"0 NaN 1 NaN NaN 0 0 \n",
"1 Lord of the Crossing 1 Rivermen House Frey 1 1 \n",
"2 Ser 1 NaN House Swyft 0 1 \n",
"3 Queen 0 NaN House Arryn 1 1 \n",
"4 Greenstone 0 Dornish House Santagar 1 1 \n",
"\n",
" age numDeadRelations popularity \n",
"0 NaN 11 0.605351 \n",
"1 97.0 1 0.896321 \n",
"2 NaN 0 0.267559 \n",
"3 23.0 0 0.183946 \n",
"4 29.0 0 0.043478 "
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"X.head()"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "209ab424",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"title 1008\n",
"male 0\n",
"culture 1269\n",
"house 427\n",
"isMarried 0\n",
"isNoble 0\n",
"age 1513\n",
"numDeadRelations 0\n",
"popularity 0\n",
"dtype: int64"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"X.isna().sum()"
]
},
{
"cell_type": "markdown",
"id": "ec7a052d",
"metadata": {},
"source": [
"В `title`, `culture`, `house` и особенно `age` остаются пропуски. Их обработаем внутри пайплайна, чтобы правила заполнения рассчитывались только по обучающей выборке."
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "3ecbf66c",
"metadata": {},
"outputs": [],
"source": [
"name = df['name'].copy()"
]
},
{
"cell_type": "markdown",
"id": "019dc278",
"metadata": {},
"source": [
"# EDA"
]
},
{
"cell_type": "markdown",
"id": "008d5771",
"metadata": {},
"source": [
"### Самые смертные дома\n",
"\n",
"Сгруппируем персонажей по домам и оставим группы более чем из 10 персонажей: для совсем маленьких домов выводы были бы слишком нестабильными. Здесь сравнивается абсолютное число смертей, а не вероятность смерти внутри дома."
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "5728f31e",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>characters</th>\n",
" <th>deaths</th>\n",
" </tr>\n",
" <tr>\n",
" <th>house</th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Alchemists' Guild</th>\n",
" <td>7</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Antler Men</th>\n",
" <td>1</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Band of Nine</th>\n",
" <td>1</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Black Ears</th>\n",
" <td>2</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Blacks</th>\n",
" <td>4</td>\n",
" <td>4</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" characters deaths\n",
"house \n",
"Alchemists' Guild 7 1\n",
"Antler Men 1 0\n",
"Band of Nine 1 1\n",
"Black Ears 2 0\n",
"Blacks 4 4"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"house_stats = (df.dropna(subset=['house'])\n",
" .groupby('house')\n",
" .agg(characters=('name', 'count'),\n",
" deaths=('death', 'sum')))\n",
"house_stats.head()"
]
},
{
"cell_type": "code",
"execution_count": 18,
"id": "3169c705",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>characters</th>\n",
" <th>deaths</th>\n",
" </tr>\n",
" <tr>\n",
" <th>house</th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Night's Watch</th>\n",
" <td>105</td>\n",
" <td>46</td>\n",
" </tr>\n",
" <tr>\n",
" <th>House Frey</th>\n",
" <td>97</td>\n",
" <td>14</td>\n",
" </tr>\n",
" <tr>\n",
" <th>House Stark</th>\n",
" <td>72</td>\n",
" <td>22</td>\n",
" </tr>\n",
" <tr>\n",
" <th>House Targaryen</th>\n",
" <td>62</td>\n",
" <td>41</td>\n",
" </tr>\n",
" <tr>\n",
" <th>House Lannister</th>\n",
" <td>49</td>\n",
" <td>18</td>\n",
" </tr>\n",
" <tr>\n",
" <th>House Greyjoy</th>\n",
" <td>41</td>\n",
" <td>14</td>\n",
" </tr>\n",
" <tr>\n",
" <th>House Tyrell</th>\n",
" <td>36</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>House Martell</th>\n",
" <td>29</td>\n",
" <td>4</td>\n",
" </tr>\n",
" <tr>\n",
" <th>House Osgrey</th>\n",
" <td>21</td>\n",
" <td>4</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Faith of the Seven</th>\n",
" <td>17</td>\n",
" <td>2</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" characters deaths\n",
"house \n",
"Night's Watch 105 46\n",
"House Frey 97 14\n",
"House Stark 72 22\n",
"House Targaryen 62 41\n",
"House Lannister 49 18\n",
"House Greyjoy 41 14\n",
"House Tyrell 36 2\n",
"House Martell 29 4\n",
"House Osgrey 21 4\n",
"Faith of the Seven 17 2"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"house_stats = house_stats[house_stats['characters'] > 10].copy()\n",
"house_stats.sort_values('characters', ascending=False).head(10)"
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "e43a3af6",
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA7YAAAIjCAYAAAA3JofcAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjgsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvwVt1zgAAAAlwSFlzAAAPYQAAD2EBqD+naQAAvLtJREFUeJzs3Qm4TWX///GvY55JMmXKPM+VTJlCVJRZMiRNkpDhkVnInDwaKFQiQ0mGiKgMZSgiMmUMUUIo4/lfn/v3X/vZe5/BORyc4f26rlVnr732Wvdaex/X+ezvfd8rUWhoaKgBAAAAABBHhdzqBgAAAAAAcD0ItgAAAACAOI1gCwAAAACI0wi2AAAAAIA4jWALAAAAAIjTCLYAAAAAgDiNYAsAAAAAiNMItgAAAACAOI1gCwAAAACI0wi2AAAAiHO2bt1q8+bN8z3etGmTLVy48Ja2CcCtQ7AFAETb1KlTLVGiRLZhw4Ywz02aNMk917BhQ7t8+TJXF8AN8ffff9vTTz9t3333ne3atctefPFF27JlC1cbSKCS3OoGAADij08//dSeffZZq1Klis2cOdMSJ058q5sEIJ6qWLGib5GCBQvaU089daubBeAWIdgCAGLEypUrrUWLFla0aFH7/PP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V1U+fPu2e96egpOCn98czbdo0VwnTH7b+1K5KlSpZjhw5rFevXu6P5VmzZrnx1XPnznXvoT8FKL3X+mN+x44d9uabb7pQ44XqG6Fnz55h1umz+Mknn1jXrl2tdu3aLvxpbObAgQPdNX/wwQevut/SpUu74Ojv/fffty+//DJg3auvvmp9+/a1pk2bus/K8ePH7Y033rCqVauG+ewr5OvY2la9H3Qt1bVf1759+/ZuG41bV2BZvny5C3waV6qxpjquJlNSIFJ4ffjhh11o0fmorfrdfPnll93nW5/Fa6HPhPbbqlUrF5Q03KBJkybuy4X69eu7bXLnzm2fffaZ+2zqsxpRAFJb1Ga993rNtVyvqLzXkbnzzjvD/JuhLzVmzJgRsE6fV302atWq5d4P77OrL030b5h+H6N7vDNnzrh9BdM56/dNXxbp8/X999+712zfvt0N9Qj+XZ0+fbr7Qs9rw6FDh9xnI7jHjH7XJ0+e7D5X6q6tz8y7777rQvC6devcZyS8fwf0u+zR70zwvwFArBIKAEA0TZkyRWWf0AULFoTmy5fP/fzAAw+Eu+2FCxdC77jjjtDixYuH/vPPP771eq1e169fv4DtL1686NYPHDgwzPH27t3rW6fH/fv39z3u0aOHO065cuVCq1Wr5luv/WjbK1euBBwnd+7coW3atPE9Hjx4cGjq1KlDd+7cGbBdr169QhMnThx64MAB9/irr75y++vcuXOYcw0+RkRt96xYscI9p/97/v3339CQkJDQ5557zreuYcOGocmSJQvds2ePb93hw4dD06ZNG1q1atXQyOzYscMd48033wxY//DDD4fmyZPH12avLS1atAjNlClT6Pnz533bFihQILRly5bu+dmzZ/vW16xZM7REiRKuzf7X4L777nOvCb4Gem/0efCMGDHCrf/ss88C3pf69esHtPX555932/n78ssv3brPP//ct07vu/97v2jRIrdN3bp1w7z+yJEjobfddlto7dq13bmWKVMmNFeuXKGnTp2K9HpG1Mbw2rlv3z732Xn11VcDttuyZUtokiRJAtar3Xrt6NGjfevUrtKlS7vPtXfd3nvvPbfdmDFjwhzfey/nzZvnthkyZEjA840bNw5NlChR6O7du33rt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AUVjVuOSfpM6RrpvIOvkbqWBl8ffa7UnTv4iwnxrpE+f/osKARHRO+
"text/plain": [
"<Figure size 900x600 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.figure(figsize=(9, 6))\n",
"\n",
"plt.barh(house_stats.index, house_stats['deaths'])\n",
"plt.title('Количество умерших персонажей по домам')\n",
"plt.xlabel('Количество умерших персонажей')\n",
"plt.ylabel('Дома')\n",
"\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"id": "4a891ef2",
"metadata": {},
"source": [
"Больше всего смертей в абсолютных числах наблюдается у Ночного Дозора и дома Таргариенов. Однако результат зависит и от размера дома, поэтому его нельзя напрямую трактовать как индивидуальный риск смерти."
]
},
{
"cell_type": "markdown",
"id": "8aea7ec3",
"metadata": {},
"source": [
"### Зависимость смертности от сюжетной популярности\n",
"\n",
"Разделим персонажей на пять примерно равных групп по популярности. Поскольку `death` принимает значения 0 и 1, среднее по группе равно доле умерших персонажей."
]
},
{
"cell_type": "code",
"execution_count": 20,
"id": "1e9fdeab",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>mean</th>\n",
" <th>count</th>\n",
" </tr>\n",
" <tr>\n",
" <th>popularity_by_group</th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>(-0.001, 0.01]</th>\n",
" <td>0.091139</td>\n",
" <td>395</td>\n",
" </tr>\n",
" <tr>\n",
" <th>(0.01, 0.0234]</th>\n",
" <td>0.194954</td>\n",
" <td>436</td>\n",
" </tr>\n",
" <tr>\n",
" <th>(0.0234, 0.0502]</th>\n",
" <td>0.271233</td>\n",
" <td>365</td>\n",
" </tr>\n",
" <tr>\n",
" <th>(0.0502, 0.117]</th>\n",
" <td>0.339779</td>\n",
" <td>362</td>\n",
" </tr>\n",
" <tr>\n",
" <th>(0.117, 1.0]</th>\n",
" <td>0.391753</td>\n",
" <td>388</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" mean count\n",
"popularity_by_group \n",
"(-0.001, 0.01] 0.091139 395\n",
"(0.01, 0.0234] 0.194954 436\n",
"(0.0234, 0.0502] 0.271233 365\n",
"(0.0502, 0.117] 0.339779 362\n",
"(0.117, 1.0] 0.391753 388"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df['popularity_by_group'] = pd.qcut(df['popularity'], q = 5)\n",
"\n",
"popularity_stats = (df.groupby('popularity_by_group')['death'].agg(['mean', 'count']))\n",
"\n",
"popularity_stats"
]
},
{
"cell_type": "code",
"execution_count": 21,
"id": "368c450b",
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAx8AAAJICAYAAAAAWFleAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjgsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvwVt1zgAAAAlwSFlzAAAPYQAAD2EBqD+naQAAqDVJREFUeJzs3Qd0FNXbBvA3vUAIJYRQAiF0CL13EKSIFEEEFIKAoCgoICqodBRsiAiCKB0VBBRRFJHeew0dEnoJoSSBkLr7nefyn/02SwLZsMlmd5/fOXuSmd2d3MzOzsx7y3ud9Hq9XoiIiIiIiLKYc1b/ASIiIiIiIgYfRERERESUbdjyQURERERE2YLBBxERERERZQsGH0RERERElC0YfBARERERUbZg8EFERERERNmCwQcREREREWULBh9ERERERJQtGHwQERFZ2eLFi+X8+fOG5fnz58uVK1esWiYioqzA4MPOnDt3T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Vuq9VOmTFHnvvDwcLOvL+Z+tto5ErBfse7zzz9/5HtvCse38TkSevTooa4tDx48eOz3QbtWValSRf/ll18a1i9atEjtj8aNG6d5LTOFc2O7du0eWf/WW2+pv6k5dOiQWn7ttddSvW748OFq/YYNG8zeJs6X2PcffPBBqte9/fbban/du3cv1fqPPvpIfaam5Tc+FrVzDr43xrAOf1+D7x3WdejQIdXr3nzzTbX+8OHD6b5Xg//R+NqS0evwmTNn1PUNx5zx9Sa965vptdTY035PKTV
"text/plain": [
"<Figure size 900x600 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.figure(figsize=(9, 6))\n",
"\n",
"plt.plot(range(len(popularity_stats)), popularity_stats['mean'], marker='o')\n",
"plt.xticks(range(len(popularity_stats)), ['Очень низкая', 'Низкая', 'Средняя', 'Высокая', 'Очень высокая'], rotation=20)\n",
"\n",
"plt.title('Среднее количество умерших персонажей по уровням популярности')\n",
"plt.xlabel('Популярность')\n",
"plt.ylabel('Среднее количество умерших персонажей')\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"id": "6e02b97c",
"metadata": {},
"source": [
"С ростом популярности доля умерших последовательно увеличивается: примерно с 9% в первой группе до 39% в последней. Значит, популярность может быть полезным признаком для модели."
]
},
{
"cell_type": "markdown",
"id": "a0362fdf",
"metadata": {},
"source": [
"### Зависимость смертности от количества погибших родственников\n",
"\n",
"Для каждого количества погибших родственников посчитаем долю смертей. Размер точки на графике показывает число персонажей в группе."
]
},
{
"cell_type": "code",
"execution_count": 22,
"id": "0babd66a",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>mean</th>\n",
" <th>count</th>\n",
" </tr>\n",
" <tr>\n",
" <th>numDeadRelations</th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>0.230428</td>\n",
" <td>1801</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>0.387755</td>\n",
" <td>49</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>0.416667</td>\n",
" <td>12</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>0.750000</td>\n",
" <td>4</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>0.666667</td>\n",
" <td>18</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>0.640000</td>\n",
" <td>25</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>0.625000</td>\n",
" <td>8</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>0.800000</td>\n",
" <td>10</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>0.400000</td>\n",
" <td>5</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>0.500000</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>0.800000</td>\n",
" <td>5</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>1.000000</td>\n",
" <td>3</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>0.500000</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15</th>\n",
" <td>0.500000</td>\n",
" <td>2</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" mean count\n",
"numDeadRelations \n",
"0 0.230428 1801\n",
"1 0.387755 49\n",
"2 0.416667 12\n",
"3 0.750000 4\n",
"4 0.666667 18\n",
"5 0.640000 25\n",
"6 0.625000 8\n",
"7 0.800000 10\n",
"8 0.400000 5\n",
"9 0.500000 2\n",
"10 0.800000 5\n",
"11 1.000000 3\n",
"12 0.500000 2\n",
"15 0.500000 2"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"relations_stats = (df.groupby('numDeadRelations')['death'].agg(['mean', 'count']))\n",
"\n",
"relations_stats"
]
},
{
"cell_type": "code",
"execution_count": 23,
"id": "993eb131",
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAArMAAAHWCAYAAABkNgFvAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjgsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvwVt1zgAAAAlwSFlzAAAPYQAAD2EBqD+naQAAZeNJREFUeJzt3Qd8FGX+x/FfEkhCL9J7ExCRXqQIKigKh2JFTwHx5FQUEDwVLNjFhqDAHdjLWbAA51lARBQ4UQQURbogIFKlBAIkkOz/9X3udv+bzSZkQ5LdTT7v12sgOzs78+wzszO/+c0zz8R4PB6PAQAAAFEoNtwFAAAAAHKLYBYAAABRi2AWAAAAUYtgFgAAAFGLYBYAAABRi2AWAAAAUYtgFgAAAFGLYBYAAABRi2AWAAAAUYtgFkDU++ijj+yHH37wvZ41a5b9/PPPYS0TAKBgEMyG6P3337eYmJigQ/PmzfNnLQHI1k8//WQjRoyw9evX2zfffGM33XSTHTx4kFoDgCKgWLgLEK3uvvtuO+2003yvH3300bCWByjKbrjhBnv55ZetcePG7vWll15qZ555ZriLBQAoAASzuXTeeefZ2Wef7Xv94osv2p49e/JqvQAIQeXKlW3lypVuKFmyZIYTTQBA4UYzgxClpqb+t+Jic1Z1GzdutCuuuMIqVqzoDrLKFn388cdBp73uuuuCNl944IEHMjV1aNeunZUpUybDdE8//XS25dA0EyZMyPTe119/7d57++233WstT6+rVKlix44dyzCtpvEuLzB4//TTT+2ss86yUqVKubL16dMnU7tFfcfSpUu78vTq1ctNW6NGDXvooYfM4/H4pvv111+Dfic15fA/iZB7773XTXvo0CHfuGD19tRTT7nx/p8fNGiQJSYm2urVqzNMq7JVqFDBfv/99yzr1FvGrIbAcqakpNj9999vjRo1soSEBKtdu7bdeeedbrw/ffbWW2+1N99805o0aeLK17ZtW1uwYEGmMmzbts3+8pe/uDrUPOvXr28333yzbzvN6Tb45ZdfuuVq2wqk9aX15rV3717729/+ZmeccYZ7r2zZsnbhhRfaihUrMnzuk08+sWLFimVah4HrZvfu3dagQQPr3r17hnKHUl+an6ZRPSmQDbaus5LdOqxXr16GaZOTk+322293ZdHytH70/fy33ayoLIHl0RUd7UveeuutDOPfe+89911KlChhlSpVsmuvvdat61DKr+0zsI78Basj728/kOrBfxuQ/fv322233earC62nJ554wtLT0zNMp9fPPvus2160LevE44ILLrClS5dmW/7A35F3G/UOWqYy8ePGjfPV//z58917M2fOzPQdVMd6b/HixUHrkX1k/u0j9RvRsadu3bpum9ZvXSeegb744gvfMaR8+fJ28cUXZ1qul8qYk+Ol/POf/7QOHTq4/Z/K3K1bN/vss89823ZO9gGB+/vixYu79+64444M+62c/jayOsYFO86Fsn9+9dVXM/3+tdwWLVq48XrfS58L3MeprrRPevzxx0NeN979h3dQHKB61z0M+Y3MbIi8G6020BPZuXOnde7c2Q4fPmzDhw+3U045xV577TW76KKL3EZ5ySWXZPqMDlz+AeeAAQMyvK8d8ZVXXmktW7Z0G1u5cuVcUDly5Mhsy6JgoUuXLi5ACpxW47TRaeP0pzaHurHGv5yvvPKK27EdPXo0w7RvvPGG2+lpB6cfrb7zP/7xD+vatat9//33GX4waWlp7mCmoOrJJ5+02bNnu6Dl+PHjLqjND9q56KAXSAdZ/UhVdtVtXFycTZs2ze3o9J0UJJ7I1Vdfbb17984wbsyYMRlea2ei9b5o0SL761//6gIutfPUul63bl2mH/tXX31l06dPd9uNtrW///3vrs6WLFnia5utg4h2FPpummfTpk1dwK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luv/32DNPo96iyN2/e3HPkyBHf+I8++sgte+zYsRmmP3bsmBv/4IMP+sa98sorbpzWSah1pPloWu/246V68N8GHn74YbddrFu3LsN0o0eP9sTFxXm2bNniXn/xxRdufsOHD89UH4HLyKrsXt5tVP/7b4vaTrSN+e8jtS3u37/fN27Xrl2uvv3rIBj2kfmzjyxRooTnt99+843/9ttv3fiRI0f6xrVq1cptk3/88YdvnI6zWr/a1wXq3Lmz+5146dgRuJ2vX7/efV77zcB9VrDtL9g2FvhdtI36q1Gjhqd3794h/zZCOX6Esn9+JeA3pN9InTp1PBdeeGGm8utz3n2cjjdar1dccUWmusrpuvHGDv4+++wzN+7dd9/15CeaGYTojz/+cP/rUtmJ6DKrMmfKTnrpLE9ndroEoCxWYNb3RBlfnd3qEkCw7MyJKKOrM0hlKLx0ZqmzJ13GDKQzNGVNd+zY4V4ro6eshvcmG6+5c+e6TI8ylJqXd9AZfMeOHV0mK5DO/AIvq+v76wwwr+kMWWeR9913X6azbNHZuc6gddau7JbqSJmHvKTLxjrTV/bUv46UnZDAOlI96zKzl87ulTnX+lJmW5lLZSf79u3rsluBvJeKQ90GtX35ly9YO3Bto95mNiqLfhOap866dZYe6LnnnnNZeJXVuy2JMhm69PvBBx9k2qZCra+cruuTobrUNq0Mtz81O1C8qGY2OaHsun6Ll112mbus60+X3nft2mVDhw5126GXmuyoLgKbh4RypSgndaQMp/z222/ZzkPrR9kpXbL1Xz89e/Z024S3SYzWrbZFXXkJFKw5Q04cOHDALWvLli3uyo5+C97tQpRhV9bM/5KsMrjKCAfbz/ljH5k/+0hdfalZs6bvtfZJOjboNyXKWKprPV32VnMoL10a11UT73T+lOH1/40Eo32kto+xY8dmahqY2+1PWVxtf/od6SqC9mk9evQI+bfhpUxu4D5X0wWTk/1zoClTprh9dLDfoP/VNu1jdLVJWVX
"text/plain": [
"<Figure size 800x500 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.figure(figsize=(8, 5))\n",
"\n",
"plt.scatter(relations_stats.index, relations_stats['mean'], s=relations_stats['count']*3)\n",
"\n",
"plt.title('Доля умерших персонажей по количеству умерших родственников')\n",
"plt.xlabel('Количество умерших родственников')\n",
"plt.ylabel('Доля умерших персонажей')\n",
"\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"id": "f713c2a6",
"metadata": {},
"source": [
"Среди персонажей без погибших родственников умерли около 23%. При наличии таких родственников доля обычно выше, но группы с большими значениями очень малы, поэтому отдельные высокие оценки могут быть случайными."
]
},
{
"cell_type": "markdown",
"id": "4ed10d83",
"metadata": {},
"source": [
"# Обучение модели\n",
"\n",
"Разделим данные на обучающую и тестовую части в пропорции 75/25. Стратификация сохраняет исходную долю умерших персонажей в обеих выборках."
]
},
{
"cell_type": "code",
"execution_count": 24,
"id": "ab9a688c",
"metadata": {},
"outputs": [],
"source": [
"from sklearn.model_selection import train_test_split\n",
"\n",
"X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=42, stratify=y)"
]
},
{
"cell_type": "code",
"execution_count": 25,
"id": "428b4d3f",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(1459, 9)\n",
"(487, 9)\n",
"death\n",
"0 74.571624\n",
"1 25.428376\n",
"Name: proportion, dtype: float64\n",
"death\n",
"0 74.537988\n",
"1 25.462012\n",
"Name: proportion, dtype: float64\n"
]
}
],
"source": [
"print(X_train.shape)\n",
"print(X_test.shape)\n",
"print(y_train.value_counts(normalize=True) * 100)\n",
"print(y_test.value_counts(normalize=True) * 100)"
]
},
{
"cell_type": "code",
"execution_count": 26,
"id": "e100a379",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Числовые признаки: Index(['male', 'isMarried', 'isNoble', 'age', 'numDeadRelations',\n",
" 'popularity'],\n",
" dtype='str')\n",
"Категориальные признаки: Index(['title', 'culture', 'house'], dtype='str')\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\Masha\\AppData\\Local\\Temp\\ipykernel_23368\\2347361538.py:2: Pandas4Warning: For backward compatibility, 'str' dtypes are included by select_dtypes when 'object' dtype is specified. This behavior is deprecated and will be removed in a future version. Explicitly pass 'str' to `include` to select them, or to `exclude` to remove them and silence this warning.\n",
"See https://pandas.pydata.org/docs/user_guide/migration-3-strings.html#string-migration-select-dtypes for details on how to write code that works with pandas 2 and 3.\n",
" categorical_features = X.select_dtypes(include=['object']).columns\n"
]
}
],
"source": [
"numerical_features = X.select_dtypes(include=['int64', 'float64']).columns\n",
"categorical_features = X.select_dtypes(include=['object']).columns\n",
"\n",
"print(\"Числовые признаки:\", numerical_features)\n",
"print(\"Категориальные признаки:\", categorical_features)"
]
},
{
"cell_type": "markdown",
"id": "19d7b4c2",
"metadata": {},
"source": [
"Для числовых признаков пропуски заполним медианой и выполним масштабирование. Для категориальных — подставим самое частое значение и применим one-hot encoding."
]
},
{
"cell_type": "code",
"execution_count": 27,
"id": "3de0d085",
"metadata": {},
"outputs": [],
"source": [
"\n",
"from sklearn.pipeline import Pipeline\n",
"from sklearn.compose import ColumnTransformer\n",
"\n",
"from sklearn.impute import SimpleImputer\n",
"from sklearn.preprocessing import OneHotEncoder, StandardScaler\n",
"\n",
"numeric_transformer = Pipeline([\n",
" ('imputer', SimpleImputer(strategy='median')),\n",
" ('scaler', StandardScaler())\n",
"])\n",
"\n",
"categorical_transformer = Pipeline([\n",
" ('imputer', SimpleImputer(strategy='most_frequent')),\n",
" ('onehot', OneHotEncoder(handle_unknown='ignore'))\n",
"])\n",
"\n",
"preprocessor = ColumnTransformer([\n",
" ('num', numeric_transformer, numerical_features),\n",
" ('cat', categorical_transformer, categorical_features)\n",
"])"
]
},
{
"cell_type": "markdown",
"id": "c3018fd5",
"metadata": {},
"source": [
"В качестве базовой интерпретируемой модели используем логистическую регрессию. Параметр `class_weight='balanced'` повышает вес редкого класса умерших персонажей."
]
},
{
"cell_type": "code",
"execution_count": 28,
"id": "d274a430",
"metadata": {},
"outputs": [],
"source": [
"from sklearn.linear_model import LogisticRegression\n",
"\n",
"logreg = Pipeline([\n",
" ('preprocessor', preprocessor),\n",
" ('model', LogisticRegression(max_iter = 1000, class_weight='balanced'))\n",
"])"
]
},
{
"cell_type": "code",
"execution_count": 29,
"id": "0bef02e5",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<style>.sk-global {\n",
" /* Definition of color scheme common for light and dark mode */\n",
" --sklearn-color-text: #000;\n",
" --sklearn-color-text-muted: #666;\n",
" --sklearn-color-line: gray;\n",
" /* Definition of color scheme for unfitted estimators */\n",
" --sklearn-color-unfitted-level-0: #fff5e6;\n",
" --sklearn-color-unfitted-level-1: #f6e4d2;\n",
" --sklearn-color-unfitted-level-2: #ffe0b3;\n",
" --sklearn-color-unfitted-level-3: chocolate;\n",
" /* Definition of color scheme for fitted estimators */\n",
" --sklearn-color-fitted-level-0: #f0f8ff;\n",
" --sklearn-color-fitted-level-1: #d4ebff;\n",
" --sklearn-color-fitted-level-2: #b3dbfd;\n",
" --sklearn-color-fitted-level-3: cornflowerblue;\n",
"}\n",
"\n",
".sk-global.light {\n",
" /* Specific color for light theme */\n",
" --sklearn-color-text-on-default-background: black;\n",
" --sklearn-color-background: white;\n",
" --sklearn-color-border-box: black;\n",
" --sklearn-color-icon: #696969;\n",
"}\n",
"\n",
".sk-global.dark {\n",
" --sklearn-color-text-on-default-background: white;\n",
" --sklearn-color-background: #111;\n",
" --sklearn-color-border-box: white;\n",
" --sklearn-color-icon: #878787;\n",
"}\n",
"\n",
".sk-global {\n",
" color: var(--sklearn-color-text);\n",
"}\n",
"\n",
".sk-global pre {\n",
" padding: 0;\n",
"}\n",
"\n",
".sk-global input.sk-hidden--visually {\n",
" border: 0;\n",
" clip-path: inset(100%);\n",
" height: 1px;\n",
" margin: -1px;\n",
" overflow: hidden;\n",
" padding: 0;\n",
" position: absolute;\n",
" width: 1px;\n",
"}\n",
"\n",
".sk-global div.sk-dashed-wrapped {\n",
" border: 1px dashed var(--sklearn-color-line);\n",
" margin: 0 0.4em 0.5em 0.4em;\n",
" box-sizing: border-box;\n",
" padding-bottom: 0.4em;\n",
" background-color: var(--sklearn-color-background);\n",
"}\n",
"\n",
".sk-global div.sk-container {\n",
" /* jupyter's `normalize.less` sets `[hidden] { display: none; }`\n",
" but bootstrap.min.css set `[hidden] { display: none !important; }`\n",
" so we also need the `!important` here to be able to override the\n",
" default hidden behavior on the sphinx rendered scikit-learn.org.\n",
" See: https://github.com/scikit-learn/scikit-learn/issues/21755 */\n",
" display: inline-block !important;\n",
" position: relative;\n",
"}\n",
"\n",
".sk-global div.sk-text-repr-fallback {\n",
" display: none;\n",
"}\n",
"\n",
"div.sk-parallel-item,\n",
"div.sk-serial,\n",
"div.sk-item {\n",
" /* draw centered vertical line to link estimators */\n",
" background-image: linear-gradient(var(--sklearn-color-text-on-default-background), var(--sklearn-color-text-on-default-background));\n",
" background-size: 2px 100%;\n",
" background-repeat: no-repeat;\n",
" background-position: center center;\n",
"}\n",
"\n",
"/* Parallel-specific style estimator block */\n",
"\n",
".sk-global div.sk-parallel-item::after {\n",
" content: \"\";\n",
" width: 100%;\n",
" border-bottom: 2px solid var(--sklearn-color-text-on-default-background);\n",
" flex-grow: 1;\n",
"}\n",
"\n",
".sk-global div.sk-parallel {\n",
" display: flex;\n",
" align-items: stretch;\n",
" justify-content: center;\n",
" background-color: var(--sklearn-color-background);\n",
" position: relative;\n",
"}\n",
"\n",
".sk-global div.sk-parallel-item {\n",
" display: flex;\n",
" flex-direction: column;\n",
"}\n",
"\n",
".sk-global div.sk-parallel-item:first-child::after {\n",
" align-self: flex-end;\n",
" width: 50%;\n",
"}\n",
"\n",
".sk-global div.sk-parallel-item:last-child::after {\n",
" align-self: flex-start;\n",
" width: 50%;\n",
"}\n",
"\n",
".sk-global div.sk-parallel-item:only-child::after {\n",
" width: 0;\n",
"}\n",
"\n",
"/* Serial-specific style estimator block */\n",
"\n",
".sk-global div.sk-serial {\n",
" display: flex;\n",
" flex-direction: column;\n",
" align-items: center;\n",
" background-color: var(--sklearn-color-background);\n",
" padding-right: 1em;\n",
" padding-left: 1em;\n",
"}\n",
"\n",
"\n",
"/* Toggleable style: style used for estimator/Pipeline/ColumnTransformer box that is\n",
"clickable and can be expanded/collapsed.\n",
"- Pipeline and ColumnTransformer use this feature and define the default style\n",
"- Estimators will overwrite some part of the style using the `sk-estimator` class\n",
"*/\n",
"\n",
"/* Pipeline and ColumnTransformer style (default) */\n",
"\n",
".sk-global div.sk-toggleable {\n",
" /* Default theme specific background. It is overwritten whether we have a\n",
" specific estimator or a Pipeline/ColumnTransformer */\n",
" background-color: var(--sklearn-color-background);\n",
"}\n",
"\n",
"/* Toggleable label */\n",
".sk-global label.sk-toggleable__label {\n",
" cursor: pointer;\n",
" display: flex;\n",
" width: 100%;\n",
" margin-bottom: 0;\n",
" padding: 0.5em;\n",
" box-sizing: border-box;\n",
" text-align: center;\n",
" align-items: center;\n",
" justify-content: center;\n",
" gap: 0.5em;\n",
"}\n",
"\n",
".sk-global label.sk-toggleable__label .caption {\n",
" font-size: 0.6rem;\n",
" font-weight: lighter;\n",
" color: var(--sklearn-color-text-muted);\n",
"}\n",
"\n",
".sk-global label.sk-toggleable__label-arrow:before {\n",
" /* Arrow on the left of the label */\n",
" content: \"▸\";\n",
" float: left;\n",
" margin-right: 0.25em;\n",
" color: var(--sklearn-color-icon);\n",
"}\n",
"\n",
".sk-global label.sk-toggleable__label-arrow:hover:before {\n",
" color: var(--sklearn-color-text);\n",
"}\n",
"\n",
"/* Toggleable content - dropdown */\n",
"\n",
".sk-global div.sk-toggleable__content {\n",
" display: none;\n",
" text-align: left;\n",
" /* unfitted */\n",
" background-color: var(--sklearn-color-unfitted-level-0);\n",
"}\n",
"\n",
".sk-global div.sk-toggleable__content.fitted {\n",
" /* fitted */\n",
" background-color: var(--sklearn-color-fitted-level-0);\n",
"}\n",
"\n",
".sk-global div.sk-toggleable__content pre {\n",
" margin: 0.2em;\n",
" border-radius: 0.25em;\n",
" color: var(--sklearn-color-text);\n",
" /* unfitted */\n",
" background-color: var(--sklearn-color-unfitted-level-0);\n",
"}\n",
"\n",
".sk-global div.sk-toggleable__content.fitted pre {\n",
" /* unfitted */\n",
" background-color: var(--sklearn-color-fitted-level-0);\n",
"}\n",
"\n",
".sk-global input.sk-toggleable__control:checked~div.sk-toggleable__content {\n",
" /* Expand drop-down */\n",
" display: block;\n",
" width: 100%;\n",
" overflow: visible;\n",
"}\n",
"\n",
".sk-global input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {\n",
" content: \"▾\";\n",
"}\n",
"\n",
"/* Pipeline/ColumnTransformer-specific style */\n",
"\n",
".sk-global div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
" color: var(--sklearn-color-text);\n",
" background-color: var(--sklearn-color-unfitted-level-2);\n",
"}\n",
"\n",
".sk-global div.sk-label.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
" background-color: var(--sklearn-color-fitted-level-2);\n",
"}\n",
"\n",
"/* Estimator-specific style */\n",
"\n",
"/* Colorize estimator box */\n",
".sk-global div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
" /* unfitted */\n",
" background-color: var(--sklearn-color-unfitted-level-2);\n",
"}\n",
"\n",
".sk-global div.sk-estimator.fitted input.sk-toggleable__control:checked~label.sk-toggleable__label {\n",
" /* fitted */\n",
" background-color: var(--sklearn-color-fitted-level-2);\n",
"}\n",
"\n",
".sk-global div.sk-label label.sk-toggleable__label,\n",
".sk-global div.sk-label label {\n",
" /* The background is the default theme color */\n",
" color: var(--sklearn-color-text-on-default-background);\n",
"}\n",
"\n",
"/* On hover, darken the color of the background */\n",
".sk-global div.sk-label:hover label.sk-toggleable__label {\n",
" color: var(--sklearn-color-text);\n",
" background-color: var(--sklearn-color-unfitted-level-2);\n",
"}\n",
"\n",
"/* Label box, darken color on hover, fitted */\n",
".sk-global div.sk-label.fitted:hover label.sk-toggleable__label.fitted {\n",
" color: var(--sklearn-color-text);\n",
" background-color: var(--sklearn-color-fitted-level-2);\n",
"}\n",
"\n",
"/* Estimator label */\n",
"\n",
".sk-global div.sk-label label {\n",
" font-family: monospace;\n",
" font-weight: bold;\n",
" line-height: 1.2em;\n",
"}\n",
"\n",
".sk-global div.sk-label-container {\n",
" text-align: center;\n",
"}\n",
"\n",
"/* Estimator-specific */\n",
".sk-global div.sk-estimator {\n",
" font-family: monospace;\n",
" border: 1px dotted var(--sklearn-color-border-box);\n",
" border-radius: 0.25em;\n",
" box-sizing: border-box;\n",
" margin-bottom: 0.5em;\n",
" /* unfitted */\n",
" background-color: var(--sklearn-color-unfitted-level-0);\n",
"}\n",
"\n",
".sk-global div.sk-estimator.fitted {\n",
" /* fitted */\n",
" background-color: var(--sklearn-color-fitted-level-0);\n",
"}\n",
"\n",
"/* on hover */\n",
".sk-global div.sk-estimator:hover {\n",
" /* unfitted */\n",
" background-color: var(--sklearn-color-unfitted-level-2);\n",
"}\n",
"\n",
".sk-global div.sk-estimator.fitted:hover {\n",
" /* fitted */\n",
" background-color: var(--sklearn-color-fitted-level-2);\n",
"}\n",
"\n",
"/* Specification for estimator info (e.g. \"i\" and \"?\") */\n",
"\n",
"/* Common style for \"i\" and \"?\" */\n",
"\n",
".sk-estimator-doc-link,\n",
"a:link.sk-estimator-doc-link,\n",
"a:visited.sk-estimator-doc-link {\n",
" float: right;\n",
" font-size: smaller;\n",
" line-height: 1em;\n",
" font-family: monospace;\n",
" background-color: var(--sklearn-color-unfitted-level-0);\n",
" border-radius: 1em;\n",
" height: 1em;\n",
" width: 1em;\n",
" text-decoration: none !important;\n",
" margin-left: 0.5em;\n",
" text-align: center;\n",
" /* unfitted */\n",
" border: var(--sklearn-color-unfitted-level-3) 1pt solid;\n",
" color: var(--sklearn-color-unfitted-level-3);\n",
"}\n",
"\n",
".sk-estimator-doc-link.fitted,\n",
"a:link.sk-estimator-doc-link.fitted,\n",
"a:visited.sk-estimator-doc-link.fitted {\n",
" /* fitted */\n",
" background-color: var(--sklearn-color-fitted-level-0);\n",
" border: var(--sklearn-color-fitted-level-3) 1pt solid;\n",
" color: var(--sklearn-color-fitted-level-3);\n",
"}\n",
"\n",
"/* On hover */\n",
"div.sk-estimator:hover .sk-estimator-doc-link:hover,\n",
".sk-estimator-doc-link:hover,\n",
"div.sk-label-container:hover .sk-estimator-doc-link:hover,\n",
".sk-estimator-doc-link:hover {\n",
" /* unfitted */\n",
" background-color: var(--sklearn-color-unfitted-level-3);\n",
" border: var(--sklearn-color-fitted-level-0) 1pt solid;\n",
" color: var(--sklearn-color-unfitted-level-0);\n",
" text-decoration: none;\n",
"}\n",
"\n",
"div.sk-estimator.fitted:hover .sk-estimator-doc-link.fitted:hover,\n",
".sk-estimator-doc-link.fitted:hover,\n",
"div.sk-label-container:hover .sk-estimator-doc-link.fitted:hover,\n",
".sk-estimator-doc-link.fitted:hover {\n",
" /* fitted */\n",
" background-color: var(--sklearn-color-fitted-level-3);\n",
" border: var(--sklearn-color-fitted-level-0) 1pt solid;\n",
" color: var(--sklearn-color-fitted-level-0);\n",
" text-decoration: none;\n",
"}\n",
"\n",
"/* Span, style for the box shown on hovering the info icon */\n",
".sk-estimator-doc-link span {\n",
" display: none;\n",
" z-index: 9999;\n",
" position: relative;\n",
" font-weight: normal;\n",
" right: .2ex;\n",
" padding: .5ex;\n",
" margin: .5ex;\n",
" width: min-content;\n",
" min-width: 20ex;\n",
" max-width: 50ex;\n",
" color: var(--sklearn-color-text);\n",
" box-shadow: 2pt 2pt 4pt #999;\n",
" /* unfitted */\n",
" background: var(--sklearn-color-unfitted-level-0);\n",
" border: .5pt solid var(--sklearn-color-unfitted-level-3);\n",
"}\n",
"\n",
".sk-estimator-doc-link.fitted span {\n",
" /* fitted */\n",
" background: var(--sklearn-color-fitted-level-0);\n",
" border: var(--sklearn-color-fitted-level-3);\n",
"}\n",
"\n",
".sk-estimator-doc-link:hover span {\n",
" display: block;\n",
"}\n",
"\n",
"/* \"?\"-specific style due to the `<a>` HTML tag */\n",
"\n",
".sk-global a.estimator_doc_link {\n",
" float: right;\n",
" font-size: 1rem;\n",
" line-height: 1em;\n",
" font-family: monospace;\n",
" background-color: var(--sklearn-color-unfitted-level-0);\n",
" border-radius: 1rem;\n",
" height: 1rem;\n",
" width: 1rem;\n",
" text-decoration: none;\n",
" /* unfitted */\n",
" color: var(--sklearn-color-unfitted-level-1);\n",
" border: var(--sklearn-color-unfitted-level-1) 1pt solid;\n",
"}\n",
"\n",
".sk-global a.estimator_doc_link.fitted {\n",
" /* fitted */\n",
" background-color: var(--sklearn-color-fitted-level-0);\n",
" border: var(--sklearn-color-fitted-level-1) 1pt solid;\n",
" color: var(--sklearn-color-fitted-level-1);\n",
"}\n",
"\n",
"/* On hover */\n",
".sk-global a.estimator_doc_link:hover {\n",
" /* unfitted */\n",
" background-color: var(--sklearn-color-unfitted-level-3);\n",
" color: var(--sklearn-color-background);\n",
" text-decoration: none;\n",
"}\n",
"\n",
".sk-global a.estimator_doc_link.fitted:hover {\n",
" /* fitted */\n",
" background-color: var(--sklearn-color-fitted-level-3);\n",
"}\n",
"\n",
".sk-top-container.sk-global {\n",
" /* pydata-sphinx-theme hides overflow, so scrolling is disabled.\n",
" We need to set it to !important and add tabindex=\"0\" in the HTML\n",
" to allow keyboard-only users to navigate the display. */\n",
" overflow-x: scroll !important;\n",
" max-width: 100%;\n",
"}\n",
"\n",
".estimator-table {\n",
" font-family: monospace;\n",
"}\n",
"\n",
".estimator-table summary {\n",
" padding: .5rem;\n",
" cursor: pointer;\n",
"}\n",
"\n",
".estimator-table summary::marker {\n",
" font-size: 0.7rem;\n",
"}\n",
"\n",
".estimator-table details[open] {\n",
" padding-left: 0.1rem;\n",
" padding-right: 0.1rem;\n",
" padding-bottom: 0.3rem;\n",
"}\n",
"\n",
".estimator-table .parameters-table {\n",
" margin-left: auto !important;\n",
" margin-right: auto !important;\n",
" margin-top: 0;\n",
"}\n",
"\n",
".estimator-table .parameters-table tr:nth-child(odd) {\n",
" background-color: #fff;\n",
"}\n",
"\n",
".estimator-table .parameters-table tr:nth-child(even) {\n",
" background-color: #f6f6f6;\n",
"}\n",
"\n",
".estimator-table .parameters-table tr:hover td {\n",
" background-color: #e0e0e0;\n",
"}\n",
"\n",
".estimator-table table :is(td, th) {\n",
" border: 1px solid rgba(106, 105, 104, 0.232);\n",
"}\n",
"\n",
"/*\n",
" `table td`is set in notebook with right text-align.\n",
" We need to overwrite it.\n",
"*/\n",
".estimator-table table td.param {\n",
" text-align: left;\n",
" position: relative;\n",
" padding: 0;\n",
"}\n",
"\n",
".user-set td {\n",
" color:rgb(255, 94, 0);\n",
" text-align: left !important;\n",
"}\n",
"\n",
".user-set td.value {\n",
" color:rgb(255, 94, 0);\n",
" background-color: transparent;\n",
"}\n",
"\n",
".default td, .estimator-table th {\n",
" color: black;\n",
" text-align: left !important;\n",
"}\n",
"\n",
".user-set td i,\n",
".default td i {\n",
" color: black;\n",
"}\n",
"\n",
"td.fitted-att-type {\n",
" white-space: preserve nowrap;\n",
"}\n",
"\n",
"/*\n",
" Styles for parameter documentation links\n",
" We need styling for visited so jupyter doesn't overwrite it\n",
"*/\n",
"a.param-doc-link,\n",
"a.param-doc-link:link,\n",
"a.param-doc-link:visited {\n",
" text-decoration: underline dashed;\n",
" text-underline-offset: .3em;\n",
" color: inherit;\n",
" display: block;\n",
" padding: .5em;\n",
"}\n",
"\n",
"@supports(anchor-name: --doc-link) {\n",
" a.param-doc-link,\n",
" a.param-doc-link:link,\n",
" a.param-doc-link:visited {\n",
" anchor-name: --doc-link;\n",
" }\n",
"}\n",
"\n",
"/* \"hack\" to make the entire area of the cell containing the link clickable */\n",
"a.param-doc-link::before {\n",
" position: absolute;\n",
" content: \"\";\n",
" inset: 0;\n",
"}\n",
"\n",
".param-doc-description {\n",
" display: none;\n",
" position: absolute;\n",
" z-index: 9999;\n",
" left: 0;\n",
" padding: .5ex;\n",
" margin-left: 1.5em;\n",
" color: var(--sklearn-color-text);\n",
" box-shadow: .3em .3em .4em #999;\n",
" width: max-content;\n",
" text-align: left;\n",
" max-height: 10em;\n",
" overflow-y: auto;\n",
"\n",
" /* unfitted */\n",
" background: var(--sklearn-color-unfitted-level-0);\n",
" border: thin solid var(--sklearn-color-unfitted-level-3);\n",
"}\n",
"\n",
"@supports(position-area: center right) {\n",
" .param-doc-description {\n",
" position-area: center right;\n",
" position: fixed;\n",
" margin-left: 0;\n",
" }\n",
"}\n",
"\n",
"/* Fitted state for parameter tooltips */\n",
".fitted .param-doc-description {\n",
" /* fitted */\n",
" background: var(--sklearn-color-fitted-level-0);\n",
" border: thin solid var(--sklearn-color-fitted-level-3);\n",
"}\n",
"\n",
".param-doc-link:hover .param-doc-description {\n",
" display: block;\n",
"}\n",
"\n",
".copy-paste-icon {\n",
" background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NDggNTEyIj48IS0tIUZvbnQgQXdlc29tZSBGcmVlIDYuNy4yIGJ5IEBmb250YXdlc29tZSAtIGh0dHBzOi8vZm9udGF3ZXNvbWUuY29tIExpY2Vuc2UgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbS9saWNlbnNlL2ZyZWUgQ29weXJpZ2h0IDIwMjUgRm9udGljb25zLCBJbmMuLS0+PHBhdGggZD0iTTIwOCAwTDMzMi4xIDBjMTIuNyAwIDI0LjkgNS4xIDMzLjkgMTQuMWw2Ny45IDY3LjljOSA5IDE0LjEgMjEuMiAxNC4xIDMzLjlMNDQ4IDMzNmMwIDI2LjUtMjEuNSA0OC00OCA0OGwtMTkyIDBjLTI2LjUgMC00OC0yMS41LTQ4LTQ4bDAtMjg4YzAtMjYuNSAyMS41LTQ4IDQ4LTQ4ek00OCAxMjhsODAgMCAwIDY0LTY0IDAgMCAyNTYgMTkyIDAgMC0zMiA2NCAwIDAgNDhjMCAyNi41LTIxLjUgNDgtNDggNDhMNDggNTEyYy0yNi41IDAtNDgtMjEuNS00OC00OEwwIDE3NmMwLTI2LjUgMjEuNS00OCA0OC00OHoiLz48L3N2Zz4=);\n",
" background-repeat: no-repeat;\n",
" background-size: 14px 14px;\n",
" background-position: 0;\n",
" display: inline-block;\n",
" width: 14px;\n",
" height: 14px;\n",
" cursor: pointer;\n",
"}\n",
"\n",
".features {\n",
" font-family: monospace;\n",
" cursor: pointer;\n",
" background-color: var(--sklearn-color-unfitted-level-0);\n",
" border: 1px dotted var(--sklearn-color-border-box);\n",
" border-radius: .20em;\n",
" margin-bottom: 0.5em;\n",
" font-size: inherit; /* Needed for jupyter */\n",
"}\n",
"\n",
".features.fitted {\n",
" background-color: var(--sklearn-color-fitted-level-0);\n",
"}\n",
"\n",
".features summary {\n",
" cursor: pointer;\n",
" display: flex;\n",
" margin-bottom: 0;\n",
" text-align: center;\n",
" align-items: center;\n",
" justify-content: center;\n",
" gap: 0.5em;\n",
" padding: .25em;\n",
"}\n",
"\n",
".features details[open] > summary {\n",
" color: var(--sklearn-color-text);\n",
" background-color: var(--sklearn-color-unfitted-level-2);\n",
" border-radius: .20em 0 0 0;\n",
"}\n",
"\n",
".features.fitted details[open] > summary {\n",
" background-color: var(--sklearn-color-fitted-level-2);\n",
" border-radius: .20em 0 0 0;\n",
"}\n",
"\n",
".features details > summary .arrow::before {\n",
" content: \"▸\";\n",
" color: grey;\n",
"}\n",
"\n",
".features details[open] > summary .arrow::before {\n",
" content: \"▾\";\n",
"}\n",
"\n",
".features details:hover > summary {\n",
" margin: 0;\n",
" background-color: var(--sklearn-color-unfitted-level-2);\n",
"}\n",
"\n",
".features.fitted details:hover > summary {\n",
" margin: 0;\n",
" background-color: var(--sklearn-color-fitted-level-2);\n",
"}\n",
"\n",
".features .features-container {\n",
" max-width: 15em;\n",
" max-height: 10em;\n",
" overflow: auto;\n",
" scrollbar-width: thin;\n",
" padding: .25em 0.1rem;\n",
" background-color: var(--sklearn-color-unfitted-level-0);\n",
" border-radius: 0 0 .5em .5em;\n",
"}\n",
"\n",
".features.fitted .features-container {\n",
" background-color: var(--sklearn-color-fitted-level-0);\n",
"}\n",
"\n",
".features .image-container {\n",
" block-size: 1em;\n",
" inline-size: 1em;\n",
" padding: 0;\n",
" margin: 0%;\n",
" display: flex;\n",
" justify-content: center;\n",
" align-items: center;\n",
"}\n",
"\n",
".features .copy-paste-icon {\n",
" background-size: 1em 1em;\n",
" width: 1em;\n",
" height: 1em;\n",
" filter: grayscale(100%) opacity(60%);\n",
"}\n",
"\n",
".features .features-container table {\n",
" width: 100%;\n",
" margin: 0.01em;\n",
"}\n",
"\n",
".features .features-container table tr:nth-child(odd) {\n",
" background-color: #fff;\n",
"}\n",
"\n",
".features .features-container table tr:nth-child(even) {\n",
" background-color: #f6f6f6;\n",
"}\n",
"\n",
".features .features-container table tr:hover {\n",
" background-color: #e0e0e0;\n",
"}\n",
"\n",
".features .features-container table {\n",
" table-layout: inherit;\n",
"}\n",
"\n",
".features .features-container table td {\n",
" text-align: left;\n",
" padding: 0 0.5em;\n",
" border: 1px solid rgba(106, 105, 104, 0.232);\n",
" white-space: nowrap;\n",
" color: var(--sklearn-color-text);\n",
"}\n",
"\n",
".total_features {\n",
" display: flex;\n",
" justify-content: center;\n",
" margin-top: 0.5em;\n",
"}\n",
"</style><body><div id=\"sk-container-id-1\" tabindex=\"0\" class=\"sk-top-container sk-global\"><div class=\"sk-text-repr-fallback\"><pre>Pipeline(steps=[(&#x27;preprocessor&#x27;,\n",
" ColumnTransformer(transformers=[(&#x27;num&#x27;,\n",
" Pipeline(steps=[(&#x27;imputer&#x27;,\n",
" SimpleImputer(strategy=&#x27;median&#x27;)),\n",
" (&#x27;scaler&#x27;,\n",
" StandardScaler())]),\n",
" Index([&#x27;male&#x27;, &#x27;isMarried&#x27;, &#x27;isNoble&#x27;, &#x27;age&#x27;, &#x27;numDeadRelations&#x27;,\n",
" &#x27;popularity&#x27;],\n",
" dtype=&#x27;str&#x27;)),\n",
" (&#x27;cat&#x27;,\n",
" Pipeline(steps=[(&#x27;imputer&#x27;,\n",
" SimpleImputer(strategy=&#x27;most_frequent&#x27;)),\n",
" (&#x27;onehot&#x27;,\n",
" OneHotEncoder(handle_unknown=&#x27;ignore&#x27;))]),\n",
" Index([&#x27;title&#x27;, &#x27;culture&#x27;, &#x27;house&#x27;], dtype=&#x27;str&#x27;))])),\n",
" (&#x27;model&#x27;,\n",
" LogisticRegression(class_weight=&#x27;balanced&#x27;, max_iter=1000))])</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class=\"sk-container\" hidden><div class=\"sk-item sk-dashed-wrapped\"><div class=\"sk-label-container\"><div class=\"sk-label fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually sk-global\" id=\"sk-estimator-id-1\" type=\"checkbox\" ><label for=\"sk-estimator-id-1\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow\"><div><div>Pipeline</div></div><div><a class=\"sk-estimator-doc-link fitted\" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.pipeline.Pipeline.html\">?<span>Documentation for Pipeline</span></a><span class=\"sk-estimator-doc-link fitted\">i<span>Fitted</span></span></div></label><div class=\"sk-toggleable__content fitted\" data-param-prefix=\"\">\n",
" <div class=\"estimator-table\">\n",
" <details>\n",
" <summary>Parameters</summary>\n",
" <table class=\"parameters-table\">\n",
" <tbody>\n",
" \n",
" <tr class=\"user-set\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('steps',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-steps;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.pipeline.Pipeline.html#:~:text=steps,-list%20of%20tuples\">\n",
" steps\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-steps;\">\n",
" steps: list of tuples<br><br>List of (name of step, estimator) tuples that are to be chained in<br>sequential order. To be compatible with the scikit-learn API, all steps<br>must define `fit`. All non-last steps must also define `transform`. See<br>:ref:`Combining Estimators &lt;combining_estimators&gt;` for more details.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">[(&#x27;preprocessor&#x27;, ...), (&#x27;model&#x27;, ...)]</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('transform_input',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-transform_input;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.pipeline.Pipeline.html#:~:text=transform_input,-list%20of%20str%2C%20default%3DNone\">\n",
" transform_input\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-transform_input;\">\n",
" transform_input: list of str, default=None<br><br>The names of the :term:`metadata` parameters that should be transformed by the<br>pipeline before passing it to the step consuming it.<br><br>This enables transforming some input arguments to ``fit`` (other than ``X``)<br>to be transformed by the steps of the pipeline up to the step which requires<br>them. Requirement is defined via :ref:`metadata routing &lt;metadata_routing&gt;`.<br>For instance, this can be used to pass a validation set through the pipeline.<br><br>You can only set this if metadata routing is enabled, which you<br>can enable using ``sklearn.set_config(enable_metadata_routing=True)``.<br><br>.. versionadded:: 1.6</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">None</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('memory',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-memory;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.pipeline.Pipeline.html#:~:text=memory,-str%20or%20object%20with%20the%20joblib.Memory%20interface%2C%20default%3DNone\">\n",
" memory\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-memory;\">\n",
" memory: str or object with the joblib.Memory interface, default=None<br><br>Used to cache the fitted transformers of the pipeline. The last step<br>will never be cached, even if it is a transformer. By default, no<br>caching is performed. If a string is given, it is the path to the<br>caching directory. Enabling caching triggers a clone of the transformers<br>before fitting. Therefore, the transformer instance given to the<br>pipeline cannot be inspected directly. Use the attribute ``named_steps``<br>or ``steps`` to inspect estimators within the pipeline. Caching the<br>transformers is advantageous when fitting is time consuming. See<br>:ref:`sphx_glr_auto_examples_neighbors_plot_caching_nearest_neighbors.py`<br>for an example on how to enable caching.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">None</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('verbose',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-verbose;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.pipeline.Pipeline.html#:~:text=verbose,-bool%2C%20default%3DFalse\">\n",
" verbose\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-verbose;\">\n",
" verbose: bool, default=False<br><br>If True, the time elapsed while fitting each step will be printed as it<br>is completed.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">False</td>\n",
" </tr>\n",
" \n",
" </tbody>\n",
" </table>\n",
" </details>\n",
" </div>\n",
" \n",
" <div class=\"estimator-table\">\n",
" <details>\n",
" <summary>Fitted attributes</summary>\n",
" <table class=\"parameters-table\">\n",
" <tbody>\n",
" <tr>\n",
" <th>Name</th>\n",
" <th>Type</th>\n",
" <th>Value</th>\n",
" </tr>\n",
" \n",
" <tr class=\"default\">\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-classes_;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.pipeline.Pipeline.html#:~:text=classes_,-ndarray%20of%20shape%20%28n_classes%2C%29\">\n",
" classes_\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-classes_;\">\n",
" classes_: ndarray of shape (n_classes,)<br><br>The classes labels. Only exist if the last step of the pipeline is a<br>classifier.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"fitted-att-type\">ndarray[int64](2,)</td>\n",
" <td>[0,1]</td>\n",
"\n",
"\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-feature_names_in_;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.pipeline.Pipeline.html#:~:text=feature_names_in_,-ndarray%20of%20shape%20%28n_features_in_%2C%29\">\n",
" feature_names_in_\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-feature_names_in_;\">\n",
" feature_names_in_: ndarray of shape (`n_features_in_`,)<br><br>Names of features seen during :term:`fit`. Only defined if the<br>underlying estimator exposes such an attribute when fit.<br><br>.. versionadded:: 1.0</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"fitted-att-type\">ndarray[object](9,)</td>\n",
" <td>[&#x27;title&#x27;,&#x27;male&#x27;,&#x27;culture&#x27;,...,&#x27;age&#x27;,&#x27;numDeadRelations&#x27;,&#x27;popularity&#x27;]</td>\n",
"\n",
"\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-n_features_in_;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.pipeline.Pipeline.html#:~:text=n_features_in_,-int\">\n",
" n_features_in_\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-n_features_in_;\">\n",
" n_features_in_: int<br><br>Number of features seen during :term:`fit`. Only defined if the<br>underlying first estimator in `steps` exposes such an attribute<br>when fit.<br><br>.. versionadded:: 0.24</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"fitted-att-type\">int</td>\n",
" <td>9</td>\n",
"\n",
"\n",
" </tr>\n",
" \n",
" </tbody>\n",
" </table>\n",
" </details>\n",
" </div>\n",
" </div></div></div><div class=\"sk-serial\"><div class=\"sk-item sk-dashed-wrapped\"><div class=\"sk-label-container\"><div class=\"sk-label fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually sk-global\" id=\"sk-estimator-id-2\" type=\"checkbox\" ><label for=\"sk-estimator-id-2\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow\"><div><div>preprocessor: ColumnTransformer</div></div><div><a class=\"sk-estimator-doc-link fitted\" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.compose.ColumnTransformer.html\">?<span>Documentation for preprocessor: ColumnTransformer</span></a></div></label><div class=\"sk-toggleable__content fitted\" data-param-prefix=\"preprocessor__\">\n",
" <div class=\"estimator-table\">\n",
" <details>\n",
" <summary>Parameters</summary>\n",
" <table class=\"parameters-table\">\n",
" <tbody>\n",
" \n",
" <tr class=\"user-set\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('transformers',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-transformers;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.compose.ColumnTransformer.html#:~:text=transformers,-list%20of%20tuples\">\n",
" transformers\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-transformers;\">\n",
" transformers: list of tuples<br><br>List of (name, transformer, columns) tuples specifying the<br>transformer objects to be applied to subsets of the data.<br><br>name : str<br> Like in Pipeline and FeatureUnion, this allows the transformer and<br> its parameters to be set using ``set_params`` and searched in grid<br> search.<br>transformer : {&#x27;drop&#x27;, &#x27;passthrough&#x27;} or estimator<br> Estimator must support :term:`fit` and :term:`transform`.<br> Special-cased strings &#x27;drop&#x27; and &#x27;passthrough&#x27; are accepted as<br> well, to indicate to drop the columns or to pass them through<br> untransformed, respectively.<br>columns : str, array-like of str, int, array-like of int, array-like of bool, slice or callable<br> Indexes the data on its second axis. Integers are interpreted as<br> positional columns, while strings can reference DataFrame columns<br> by name. A scalar string or int should be used where<br> ``transformer`` expects X to be a 1d array-like (vector),<br> otherwise a 2d array will be passed to the transformer.<br> A callable is passed the input data `X` and can return any of the<br> above. To select multiple columns by name or dtype, you can use<br> :obj:`make_column_selector`.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">[(&#x27;num&#x27;, ...), (&#x27;cat&#x27;, ...)]</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('remainder',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-remainder;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.compose.ColumnTransformer.html#:~:text=remainder,-%7B%27drop%27%2C%20%27passthrough%27%7D%20or%20estimator%2C%20default%3D%27drop%27\">\n",
" remainder\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-remainder;\">\n",
" remainder: {&#x27;drop&#x27;, &#x27;passthrough&#x27;} or estimator, default=&#x27;drop&#x27;<br><br>By default, only the specified columns in `transformers` are<br>transformed and combined in the output, and the non-specified<br>columns are dropped. (default of ``&#x27;drop&#x27;``).<br>By specifying ``remainder=&#x27;passthrough&#x27;``, all remaining columns that<br>were not specified in `transformers`, but present in the data passed<br>to `fit` will be automatically passed through. This subset of columns<br>is concatenated with the output of the transformers. For dataframes,<br>extra columns not seen during `fit` will be excluded from the output<br>of `transform`.<br>By setting ``remainder`` to be an estimator, the remaining<br>non-specified columns will use the ``remainder`` estimator. The<br>estimator must support :term:`fit` and :term:`transform`.<br>Note that using this feature requires that the DataFrame columns<br>input at :term:`fit` and :term:`transform` have identical order.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">&#x27;drop&#x27;</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('sparse_threshold',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-sparse_threshold;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.compose.ColumnTransformer.html#:~:text=sparse_threshold,-float%2C%20default%3D0.3\">\n",
" sparse_threshold\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-sparse_threshold;\">\n",
" sparse_threshold: float, default=0.3<br><br>If the output of the different transformers contains sparse matrices,<br>these will be stacked as a sparse matrix if the overall density is<br>lower than this value. Use ``sparse_threshold=0`` to always return<br>dense. When the transformed output consists of all dense data, the<br>stacked result will be dense, and this keyword will be ignored.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">0.3</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('n_jobs',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-n_jobs;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.compose.ColumnTransformer.html#:~:text=n_jobs,-int%2C%20default%3DNone\">\n",
" n_jobs\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-n_jobs;\">\n",
" n_jobs: int, default=None<br><br>Number of jobs to run in parallel.<br>``None`` means 1 unless in a :obj:`joblib.parallel_backend` context.<br>``-1`` means using all processors. See :term:`Glossary &lt;n_jobs&gt;`<br>for more details.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">None</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('transformer_weights',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-transformer_weights;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.compose.ColumnTransformer.html#:~:text=transformer_weights,-dict%2C%20default%3DNone\">\n",
" transformer_weights\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-transformer_weights;\">\n",
" transformer_weights: dict, default=None<br><br>Multiplicative weights for features per transformer. The output of the<br>transformer is multiplied by these weights. Keys are transformer names,<br>values the weights.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">None</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('verbose',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-verbose;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.compose.ColumnTransformer.html#:~:text=verbose,-bool%2C%20default%3DFalse\">\n",
" verbose\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-verbose;\">\n",
" verbose: bool, default=False<br><br>If True, the time elapsed while fitting each transformer will be<br>printed as it is completed.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">False</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('verbose_feature_names_out',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-verbose_feature_names_out;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.compose.ColumnTransformer.html#:~:text=verbose_feature_names_out,-bool%2C%20str%20or%20Callable%5B%5Bstr%2C%20str%5D%2C%20str%5D%2C%20default%3DTrue\">\n",
" verbose_feature_names_out\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-verbose_feature_names_out;\">\n",
" verbose_feature_names_out: bool, str or Callable[[str, str], str], default=True<br><br>- If True, :meth:`ColumnTransformer.get_feature_names_out` will prefix<br> all feature names with the name of the transformer that generated that<br> feature. It is equivalent to setting<br> `verbose_feature_names_out=&quot;{transformer_name}__{feature_name}&quot;`.<br>- If False, :meth:`ColumnTransformer.get_feature_names_out` will not<br> prefix any feature names and will error if feature names are not<br> unique.<br>- If ``Callable[[str, str], str]``,<br> :meth:`ColumnTransformer.get_feature_names_out` will rename all the features<br> using the name of the transformer. The first argument of the callable is the<br> transformer name and the second argument is the feature name. The returned<br> string will be the new feature name.<br>- If ``str``, it must be a string ready for formatting. The given string will<br> be formatted using two field names: ``transformer_name`` and ``feature_name``.<br> e.g. ``&quot;{feature_name}__{transformer_name}&quot;``. See :meth:`str.format` method<br> from the standard library for more info.<br><br>.. versionadded:: 1.0<br><br>.. versionchanged:: 1.6<br> `verbose_feature_names_out` can be a callable or a string to be formatted.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">True</td>\n",
" </tr>\n",
" \n",
" </tbody>\n",
" </table>\n",
" </details>\n",
" </div>\n",
" \n",
" <div class=\"estimator-table\">\n",
" <details>\n",
" <summary>Fitted attributes</summary>\n",
" <table class=\"parameters-table\">\n",
" <tbody>\n",
" <tr>\n",
" <th>Name</th>\n",
" <th>Type</th>\n",
" <th>Value</th>\n",
" </tr>\n",
" \n",
" <tr class=\"default\">\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-feature_names_in_;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.compose.ColumnTransformer.html#:~:text=feature_names_in_,-ndarray%20of%20shape%20%28n_features_in_%2C%29\">\n",
" feature_names_in_\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-feature_names_in_;\">\n",
" feature_names_in_: ndarray of shape (`n_features_in_`,)<br><br>Names of features seen during :term:`fit`. Defined only when `X`<br>has feature names that are all strings.<br><br>.. versionadded:: 1.0</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"fitted-att-type\">ndarray[object](9,)</td>\n",
" <td>[&#x27;title&#x27;,&#x27;male&#x27;,&#x27;culture&#x27;,...,&#x27;age&#x27;,&#x27;numDeadRelations&#x27;,&#x27;popularity&#x27;]</td>\n",
"\n",
"\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-n_features_in_;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.compose.ColumnTransformer.html#:~:text=n_features_in_,-int\">\n",
" n_features_in_\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-n_features_in_;\">\n",
" n_features_in_: int<br><br>Number of features seen during :term:`fit`. Only defined if the<br>underlying transformers expose such an attribute when fit.<br><br>.. versionadded:: 0.24</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"fitted-att-type\">int</td>\n",
" <td>9</td>\n",
"\n",
"\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-named_transformers_;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.compose.ColumnTransformer.html#:~:text=named_transformers_,-%3Aclass%3A~sklearn.utils.Bunch\">\n",
" named_transformers_\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-named_transformers_;\">\n",
" named_transformers_: :class:`~sklearn.utils.Bunch`<br><br>Read-only attribute to access any transformer by given name.<br>Keys are transformer names and values are the fitted transformer<br>objects.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"fitted-att-type\">Bunch</td>\n",
" <td>{&#x27;num&#x27;: Pipel...=&#x27;ignore&#x27;))])}</td>\n",
"\n",
"\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-output_indices_;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.compose.ColumnTransformer.html#:~:text=output_indices_,-dict\">\n",
" output_indices_\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-output_indices_;\">\n",
" output_indices_: dict<br><br>A dictionary from each transformer name to a slice, where the slice<br>corresponds to indices in the transformed output. This is useful to<br>inspect which transformer is responsible for which transformed<br>feature(s).<br><br>.. versionadded:: 1.0</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"fitted-att-type\">dict</td>\n",
" <td>{&#x27;cat&#x27;: slice(6, 575, None), &#x27;num&#x27;: slice(0, 6, None), &#x27;re...er&#x27;: slice(0, 0, None)}</td>\n",
"\n",
"\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-sparse_output_;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.compose.ColumnTransformer.html#:~:text=sparse_output_,-bool\">\n",
" sparse_output_\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-sparse_output_;\">\n",
" sparse_output_: bool<br><br>Boolean flag indicating whether the output of ``transform`` is a<br>sparse matrix or a dense numpy array, which depends on the output<br>of the individual transformers and the `sparse_threshold` keyword.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"fitted-att-type\">bool</td>\n",
" <td>True</td>\n",
"\n",
"\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-transformers_;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.compose.ColumnTransformer.html#:~:text=transformers_,-list\">\n",
" transformers_\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-transformers_;\">\n",
" transformers_: list<br><br>The collection of fitted transformers as tuples of (name,<br>fitted_transformer, column). `fitted_transformer` can be an estimator,<br>or `&#x27;drop&#x27;`; `&#x27;passthrough&#x27;` is replaced with an equivalent<br>:class:`~sklearn.preprocessing.FunctionTransformer`. In case there were<br>no columns selected, this will be the unfitted transformer. If there<br>are remaining columns, the final element is a tuple of the form:<br>(&#x27;remainder&#x27;, transformer, remaining_columns) corresponding to the<br>``remainder`` parameter. If there are remaining columns, then<br>``len(transformers_)==len(transformers)+1``, otherwise<br>``len(transformers_)==len(transformers)``.<br><br>.. versionadded:: 1.7<br> The format of the remaining columns now attempts to match that of the other<br> transformers: if all columns were provided as column names (`str`), the<br> remaining columns are stored as column names; if all columns were provided<br> as mask arrays (`bool`), so are the remaining columns; in all other cases<br> the remaining columns are stored as indices (`int`).</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"fitted-att-type\">list</td>\n",
" <td>[(&#x27;num&#x27;, Pipeline(step...ardScaler())]), Index([&#x27;male&#x27;... dtype=&#x27;str&#x27;)), (&#x27;cat&#x27;, Pipeline(step...n=&#x27;ignore&#x27;))]), Index([&#x27;title..., dtype=&#x27;str&#x27;))]</td>\n",
"\n",
"\n",
" </tr>\n",
" \n",
" </tbody>\n",
" </table>\n",
" </details>\n",
" </div>\n",
" </div></div></div><div class=\"sk-parallel\"><div class=\"sk-parallel-item\"><div class=\"sk-item\"><div class=\"sk-label-container\"><div class=\"sk-label fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually sk-global\" id=\"sk-estimator-id-3\" type=\"checkbox\" ><label for=\"sk-estimator-id-3\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow\"><div><div>num</div></div></label><div class=\"sk-toggleable__content fitted\" data-param-prefix=\"preprocessor__num__\"><pre>Index([&#x27;male&#x27;, &#x27;isMarried&#x27;, &#x27;isNoble&#x27;, &#x27;age&#x27;, &#x27;numDeadRelations&#x27;,\n",
" &#x27;popularity&#x27;],\n",
" dtype=&#x27;str&#x27;)</pre></div></div></div><div class=\"sk-serial\"><div class=\"sk-item\"><div class=\"sk-serial\"><div class=\"sk-item\"><div class=\"sk-estimator fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually sk-global\" id=\"sk-estimator-id-4\" type=\"checkbox\" ><label for=\"sk-estimator-id-4\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow\"><div><div>SimpleImputer</div></div><div><a class=\"sk-estimator-doc-link fitted\" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.impute.SimpleImputer.html\">?<span>Documentation for SimpleImputer</span></a></div></label><div class=\"sk-toggleable__content fitted\" data-param-prefix=\"preprocessor__num__imputer__\">\n",
" <div class=\"estimator-table\">\n",
" <details>\n",
" <summary>Parameters</summary>\n",
" <table class=\"parameters-table\">\n",
" <tbody>\n",
" \n",
" <tr class=\"user-set\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('strategy',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-strategy;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.impute.SimpleImputer.html#:~:text=strategy,-str%20or%20Callable%2C%20default%3D%27mean%27\">\n",
" strategy\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-strategy;\">\n",
" strategy: str or Callable, default=&#x27;mean&#x27;<br><br>The imputation strategy.<br><br>- If &quot;mean&quot;, then replace missing values using the mean along<br> each column. Can only be used with numeric data.<br>- If &quot;median&quot;, then replace missing values using the median along<br> each column. Can only be used with numeric data.<br>- If &quot;most_frequent&quot;, then replace missing using the most frequent<br> value along each column. Can be used with strings or numeric data.<br> If there is more than one such value, only the smallest is returned.<br>- If &quot;constant&quot;, then replace missing values with fill_value. Can be<br> used with strings or numeric data.<br>- If an instance of Callable, then replace missing values using the<br> scalar statistic returned by running the callable over a dense 1d<br> array containing non-missing values of each column.<br><br>.. versionadded:: 0.20<br> strategy=&quot;constant&quot; for fixed value imputation.<br><br>.. versionadded:: 1.5<br> strategy=callable for custom value imputation.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">&#x27;median&#x27;</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('missing_values',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-missing_values;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.impute.SimpleImputer.html#:~:text=missing_values,-int%2C%20float%2C%20str%2C%20np.nan%2C%20None%20or%20pandas.NA%2C%20default%3Dnp.nan\">\n",
" missing_values\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-missing_values;\">\n",
" missing_values: int, float, str, np.nan, None or pandas.NA, default=np.nan<br><br>The placeholder for the missing values. All occurrences of<br>`missing_values` will be imputed. For pandas&#x27; dataframes with<br>nullable integer dtypes with missing values, `missing_values`<br>can be set to either `np.nan` or `pd.NA`.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">nan</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('fill_value',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-fill_value;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.impute.SimpleImputer.html#:~:text=fill_value,-str%20or%20numerical%20value%2C%20default%3DNone\">\n",
" fill_value\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-fill_value;\">\n",
" fill_value: str or numerical value, default=None<br><br>When strategy == &quot;constant&quot;, `fill_value` is used to replace all<br>occurrences of missing_values. For string or object data types,<br>`fill_value` must be a string.<br>If `None`, `fill_value` will be 0 when imputing numerical<br>data and &quot;missing_value&quot; for strings or object data types.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">None</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('copy',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-copy;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.impute.SimpleImputer.html#:~:text=copy,-bool%2C%20default%3DTrue\">\n",
" copy\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-copy;\">\n",
" copy: bool, default=True<br><br>If True, a copy of X will be created. If False, imputation will<br>be done in-place whenever possible. Note that, in the following cases,<br>a new copy will always be made, even if `copy=False`:<br><br>- If `X` is not an array of floating values;<br>- If `X` is encoded as a CSR matrix;<br>- If `add_indicator=True`.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">True</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('add_indicator',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-add_indicator;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.impute.SimpleImputer.html#:~:text=add_indicator,-bool%2C%20default%3DFalse\">\n",
" add_indicator\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-add_indicator;\">\n",
" add_indicator: bool, default=False<br><br>If True, a :class:`MissingIndicator` transform will stack onto output<br>of the imputer&#x27;s transform. This allows a predictive estimator<br>to account for missingness despite imputation. If a feature has no<br>missing values at fit/train time, the feature won&#x27;t appear on<br>the missing indicator even if there are missing values at<br>transform/test time.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">False</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('keep_empty_features',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-keep_empty_features;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.impute.SimpleImputer.html#:~:text=keep_empty_features,-bool%2C%20default%3DFalse\">\n",
" keep_empty_features\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-keep_empty_features;\">\n",
" keep_empty_features: bool, default=False<br><br>If True, features that consist exclusively of missing values when<br>`fit` is called are returned in results when `transform` is called.<br>The imputed value is always `0` except when `strategy=&quot;constant&quot;`<br>in which case `fill_value` will be used instead.<br><br>.. versionadded:: 1.2</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">False</td>\n",
" </tr>\n",
" \n",
" </tbody>\n",
" </table>\n",
" </details>\n",
" </div>\n",
" \n",
" <div class=\"estimator-table\">\n",
" <details>\n",
" <summary>Fitted attributes</summary>\n",
" <table class=\"parameters-table\">\n",
" <tbody>\n",
" <tr>\n",
" <th>Name</th>\n",
" <th>Type</th>\n",
" <th>Value</th>\n",
" </tr>\n",
" \n",
" <tr class=\"default\">\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-feature_names_in_;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.impute.SimpleImputer.html#:~:text=feature_names_in_,-ndarray%20of%20shape%20%28n_features_in_%2C%29\">\n",
" feature_names_in_\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-feature_names_in_;\">\n",
" feature_names_in_: ndarray of shape (`n_features_in_`,)<br><br>Names of features seen during :term:`fit`. Defined only when `X`<br>has feature names that are all strings.<br><br>.. versionadded:: 1.0</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"fitted-att-type\">ndarray[object](6,)</td>\n",
" <td>[&#x27;male&#x27;,&#x27;isMarried&#x27;,&#x27;isNoble&#x27;,&#x27;age&#x27;,&#x27;numDeadRelations&#x27;,&#x27;popularity&#x27;]</td>\n",
"\n",
"\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-indicator_;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.impute.SimpleImputer.html#:~:text=indicator_,-%3Aclass%3A~sklearn.impute.MissingIndicator\">\n",
" indicator_\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-indicator_;\">\n",
" indicator_: :class:`~sklearn.impute.MissingIndicator`<br><br>Indicator used to add binary indicators for missing values.<br>`None` if `add_indicator=False`.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"fitted-att-type\">NoneType</td>\n",
" <td>None</td>\n",
"\n",
"\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-n_features_in_;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.impute.SimpleImputer.html#:~:text=n_features_in_,-int\">\n",
" n_features_in_\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-n_features_in_;\">\n",
" n_features_in_: int<br><br>Number of features seen during :term:`fit`.<br><br>.. versionadded:: 0.24</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"fitted-att-type\">int</td>\n",
" <td>6</td>\n",
"\n",
"\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-statistics_;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.impute.SimpleImputer.html#:~:text=statistics_,-array%20of%20shape%20%28n_features%2C%29\">\n",
" statistics_\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-statistics_;\">\n",
" statistics_: array of shape (n_features,)<br><br>The imputation fill value for each feature.<br>Computing statistics can result in `np.nan` values.<br>During :meth:`transform`, features corresponding to `np.nan`<br>statistics will be discarded.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"fitted-att-type\">ndarray[float64](6,)</td>\n",
" <td>[ 1. , 0. , 0. ,28.5 , 0. , 0.03]</td>\n",
"\n",
"\n",
" </tr>\n",
" \n",
" </tbody>\n",
" </table>\n",
" </details>\n",
" </div>\n",
" </div></div></div>\n",
" <div class=\"features fitted\">\n",
" <details>\n",
" <summary>\n",
" <div class=\"arrow\"></div>\n",
" <div>6 features</div>\n",
" <div class=\"image-container\" title=\"Copy all output features\">\n",
" <i class=\"copy-paste-icon\"\n",
" onclick=\"\n",
" event.stopPropagation();\n",
" event.preventDefault();\n",
" copyFeatureNamesToClipboard(this);\n",
" \"\n",
" >\n",
" </i>\n",
" </div>\n",
" </summary>\n",
" <div class=\"features-container\">\n",
" <table class=\"features-table\">\n",
" <tbody>\n",
" \n",
" <tr>\n",
" <td>male</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>isMarried</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>isNoble</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>age</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>numDeadRelations</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>popularity</td>\n",
" </tr>\n",
"\n",
" \n",
" </tbody>\n",
" </table>\n",
" </div>\n",
" </details>\n",
" </div>\n",
" <div class=\"sk-item\"><div class=\"sk-estimator fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually sk-global\" id=\"sk-estimator-id-5\" type=\"checkbox\" ><label for=\"sk-estimator-id-5\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow\"><div><div>StandardScaler</div></div><div><a class=\"sk-estimator-doc-link fitted\" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.preprocessing.StandardScaler.html\">?<span>Documentation for StandardScaler</span></a></div></label><div class=\"sk-toggleable__content fitted\" data-param-prefix=\"preprocessor__num__scaler__\">\n",
" <div class=\"estimator-table\">\n",
" <details>\n",
" <summary>Parameters</summary>\n",
" <table class=\"parameters-table\">\n",
" <tbody>\n",
" \n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('copy',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-copy;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.preprocessing.StandardScaler.html#:~:text=copy,-bool%2C%20default%3DTrue\">\n",
" copy\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-copy;\">\n",
" copy: bool, default=True<br><br>If False, try to avoid a copy and do inplace scaling instead.<br>This is not guaranteed to always work inplace; e.g. if the data is<br>not a NumPy array or scipy.sparse CSR matrix, a copy may still be<br>returned.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">True</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('with_mean',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-with_mean;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.preprocessing.StandardScaler.html#:~:text=with_mean,-bool%2C%20default%3DTrue\">\n",
" with_mean\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-with_mean;\">\n",
" with_mean: bool, default=True<br><br>If True, center the data before scaling.<br>This does not work (and will raise an exception) when attempted on<br>sparse matrices, because centering them entails building a dense<br>matrix which in common use cases is likely to be too large to fit in<br>memory.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">True</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('with_std',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-with_std;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.preprocessing.StandardScaler.html#:~:text=with_std,-bool%2C%20default%3DTrue\">\n",
" with_std\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-with_std;\">\n",
" with_std: bool, default=True<br><br>If True, scale the data to unit variance (or equivalently,<br>unit standard deviation).</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">True</td>\n",
" </tr>\n",
" \n",
" </tbody>\n",
" </table>\n",
" </details>\n",
" </div>\n",
" \n",
" <div class=\"estimator-table\">\n",
" <details>\n",
" <summary>Fitted attributes</summary>\n",
" <table class=\"parameters-table\">\n",
" <tbody>\n",
" <tr>\n",
" <th>Name</th>\n",
" <th>Type</th>\n",
" <th>Value</th>\n",
" </tr>\n",
" \n",
" <tr class=\"default\">\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-mean_;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.preprocessing.StandardScaler.html#:~:text=mean_,-ndarray%20of%20shape%20%28n_features%2C%29%20or%20None\">\n",
" mean_\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-mean_;\">\n",
" mean_: ndarray of shape (n_features,) or None<br><br>The mean value for each feature in the training set.<br>Equal to ``None`` when ``with_mean=False`` and ``with_std=False``.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"fitted-att-type\">ndarray[float64](6,)</td>\n",
" <td>[ 0.63, 0.14, 0.46,-173.77, 0.3 , 0.09]</td>\n",
"\n",
"\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-n_features_in_;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.preprocessing.StandardScaler.html#:~:text=n_features_in_,-int\">\n",
" n_features_in_\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-n_features_in_;\">\n",
" n_features_in_: int<br><br>Number of features seen during :term:`fit`.<br><br>.. versionadded:: 0.24</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"fitted-att-type\">int</td>\n",
" <td>6</td>\n",
"\n",
"\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-n_samples_seen_;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.preprocessing.StandardScaler.html#:~:text=n_samples_seen_,-int%20or%20ndarray%20of%20shape%20%28n_features%2C%29\">\n",
" n_samples_seen_\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-n_samples_seen_;\">\n",
" n_samples_seen_: int or ndarray of shape (n_features,)<br><br>The number of samples processed by the estimator for each feature.<br>If there are no missing samples, the ``n_samples_seen`` will be an<br>integer, otherwise it will be an array of dtype int. If<br>`sample_weights` are used it will be a float (if no missing data)<br>or an array of dtype float that sums the weights seen so far.<br>Will be reset on new calls to fit, but increments across<br>``partial_fit`` calls.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"fitted-att-type\">float64</td>\n",
" <td>1459</td>\n",
"\n",
"\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-scale_;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.preprocessing.StandardScaler.html#:~:text=scale_,-ndarray%20of%20shape%20%28n_features%2C%29%20or%20None\">\n",
" scale_\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-scale_;\">\n",
" scale_: ndarray of shape (n_features,) or None<br><br>Per feature relative scaling of the data to achieve zero mean and unit<br>variance. Generally this is calculated using `np.sqrt(var_)`. If a<br>variance is zero, we can&#x27;t achieve unit variance, and the data is left<br>as-is, giving a scaling factor of 1. `scale_` is equal to `None`<br>when `with_std=False`.<br><br>.. versionadded:: 0.17<br> *scale_*</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"fitted-att-type\">ndarray[float64](6,)</td>\n",
" <td>[ 0.48, 0.35, 0.5 ,7799.85, 1.32, 0.16]</td>\n",
"\n",
"\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-var_;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.preprocessing.StandardScaler.html#:~:text=var_,-ndarray%20of%20shape%20%28n_features%2C%29%20or%20None\">\n",
" var_\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-var_;\">\n",
" var_: ndarray of shape (n_features,) or None<br><br>The variance for each feature in the training set. Used to compute<br>`scale_`. Equal to ``None`` when ``with_mean=False`` and<br>``with_std=False``.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"fitted-att-type\">ndarray[float64](6,)</td>\n",
" <td>[ 0.23, 0.12, 0.25,60837648.22, 1.74, 0.03]</td>\n",
"\n",
"\n",
" </tr>\n",
" \n",
" </tbody>\n",
" </table>\n",
" </details>\n",
" </div>\n",
" </div></div></div>\n",
" <div class=\"features fitted\">\n",
" <details>\n",
" <summary>\n",
" <div class=\"arrow\"></div>\n",
" <div>6 features</div>\n",
" <div class=\"image-container\" title=\"Copy all output features\">\n",
" <i class=\"copy-paste-icon\"\n",
" onclick=\"\n",
" event.stopPropagation();\n",
" event.preventDefault();\n",
" copyFeatureNamesToClipboard(this);\n",
" \"\n",
" >\n",
" </i>\n",
" </div>\n",
" </summary>\n",
" <div class=\"features-container\">\n",
" <table class=\"features-table\">\n",
" <tbody>\n",
" \n",
" <tr>\n",
" <td>x0</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x3</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x4</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x5</td>\n",
" </tr>\n",
"\n",
" \n",
" </tbody>\n",
" </table>\n",
" </div>\n",
" </details>\n",
" </div>\n",
" </div></div></div></div></div><div class=\"sk-parallel-item\"><div class=\"sk-item\"><div class=\"sk-label-container\"><div class=\"sk-label fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually sk-global\" id=\"sk-estimator-id-6\" type=\"checkbox\" ><label for=\"sk-estimator-id-6\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow\"><div><div>cat</div></div></label><div class=\"sk-toggleable__content fitted\" data-param-prefix=\"preprocessor__cat__\"><pre>Index([&#x27;title&#x27;, &#x27;culture&#x27;, &#x27;house&#x27;], dtype=&#x27;str&#x27;)</pre></div></div></div><div class=\"sk-serial\"><div class=\"sk-item\"><div class=\"sk-serial\"><div class=\"sk-item\"><div class=\"sk-estimator fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually sk-global\" id=\"sk-estimator-id-7\" type=\"checkbox\" ><label for=\"sk-estimator-id-7\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow\"><div><div>SimpleImputer</div></div><div><a class=\"sk-estimator-doc-link fitted\" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.impute.SimpleImputer.html\">?<span>Documentation for SimpleImputer</span></a></div></label><div class=\"sk-toggleable__content fitted\" data-param-prefix=\"preprocessor__cat__imputer__\">\n",
" <div class=\"estimator-table\">\n",
" <details>\n",
" <summary>Parameters</summary>\n",
" <table class=\"parameters-table\">\n",
" <tbody>\n",
" \n",
" <tr class=\"user-set\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('strategy',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-strategy;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.impute.SimpleImputer.html#:~:text=strategy,-str%20or%20Callable%2C%20default%3D%27mean%27\">\n",
" strategy\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-strategy;\">\n",
" strategy: str or Callable, default=&#x27;mean&#x27;<br><br>The imputation strategy.<br><br>- If &quot;mean&quot;, then replace missing values using the mean along<br> each column. Can only be used with numeric data.<br>- If &quot;median&quot;, then replace missing values using the median along<br> each column. Can only be used with numeric data.<br>- If &quot;most_frequent&quot;, then replace missing using the most frequent<br> value along each column. Can be used with strings or numeric data.<br> If there is more than one such value, only the smallest is returned.<br>- If &quot;constant&quot;, then replace missing values with fill_value. Can be<br> used with strings or numeric data.<br>- If an instance of Callable, then replace missing values using the<br> scalar statistic returned by running the callable over a dense 1d<br> array containing non-missing values of each column.<br><br>.. versionadded:: 0.20<br> strategy=&quot;constant&quot; for fixed value imputation.<br><br>.. versionadded:: 1.5<br> strategy=callable for custom value imputation.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">&#x27;most_frequent&#x27;</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('missing_values',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-missing_values;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.impute.SimpleImputer.html#:~:text=missing_values,-int%2C%20float%2C%20str%2C%20np.nan%2C%20None%20or%20pandas.NA%2C%20default%3Dnp.nan\">\n",
" missing_values\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-missing_values;\">\n",
" missing_values: int, float, str, np.nan, None or pandas.NA, default=np.nan<br><br>The placeholder for the missing values. All occurrences of<br>`missing_values` will be imputed. For pandas&#x27; dataframes with<br>nullable integer dtypes with missing values, `missing_values`<br>can be set to either `np.nan` or `pd.NA`.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">nan</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('fill_value',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-fill_value;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.impute.SimpleImputer.html#:~:text=fill_value,-str%20or%20numerical%20value%2C%20default%3DNone\">\n",
" fill_value\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-fill_value;\">\n",
" fill_value: str or numerical value, default=None<br><br>When strategy == &quot;constant&quot;, `fill_value` is used to replace all<br>occurrences of missing_values. For string or object data types,<br>`fill_value` must be a string.<br>If `None`, `fill_value` will be 0 when imputing numerical<br>data and &quot;missing_value&quot; for strings or object data types.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">None</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('copy',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-copy;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.impute.SimpleImputer.html#:~:text=copy,-bool%2C%20default%3DTrue\">\n",
" copy\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-copy;\">\n",
" copy: bool, default=True<br><br>If True, a copy of X will be created. If False, imputation will<br>be done in-place whenever possible. Note that, in the following cases,<br>a new copy will always be made, even if `copy=False`:<br><br>- If `X` is not an array of floating values;<br>- If `X` is encoded as a CSR matrix;<br>- If `add_indicator=True`.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">True</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('add_indicator',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-add_indicator;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.impute.SimpleImputer.html#:~:text=add_indicator,-bool%2C%20default%3DFalse\">\n",
" add_indicator\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-add_indicator;\">\n",
" add_indicator: bool, default=False<br><br>If True, a :class:`MissingIndicator` transform will stack onto output<br>of the imputer&#x27;s transform. This allows a predictive estimator<br>to account for missingness despite imputation. If a feature has no<br>missing values at fit/train time, the feature won&#x27;t appear on<br>the missing indicator even if there are missing values at<br>transform/test time.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">False</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('keep_empty_features',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-keep_empty_features;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.impute.SimpleImputer.html#:~:text=keep_empty_features,-bool%2C%20default%3DFalse\">\n",
" keep_empty_features\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-keep_empty_features;\">\n",
" keep_empty_features: bool, default=False<br><br>If True, features that consist exclusively of missing values when<br>`fit` is called are returned in results when `transform` is called.<br>The imputed value is always `0` except when `strategy=&quot;constant&quot;`<br>in which case `fill_value` will be used instead.<br><br>.. versionadded:: 1.2</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">False</td>\n",
" </tr>\n",
" \n",
" </tbody>\n",
" </table>\n",
" </details>\n",
" </div>\n",
" \n",
" <div class=\"estimator-table\">\n",
" <details>\n",
" <summary>Fitted attributes</summary>\n",
" <table class=\"parameters-table\">\n",
" <tbody>\n",
" <tr>\n",
" <th>Name</th>\n",
" <th>Type</th>\n",
" <th>Value</th>\n",
" </tr>\n",
" \n",
" <tr class=\"default\">\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-feature_names_in_;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.impute.SimpleImputer.html#:~:text=feature_names_in_,-ndarray%20of%20shape%20%28n_features_in_%2C%29\">\n",
" feature_names_in_\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-feature_names_in_;\">\n",
" feature_names_in_: ndarray of shape (`n_features_in_`,)<br><br>Names of features seen during :term:`fit`. Defined only when `X`<br>has feature names that are all strings.<br><br>.. versionadded:: 1.0</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"fitted-att-type\">ndarray[object](3,)</td>\n",
" <td>[&#x27;title&#x27;,&#x27;culture&#x27;,&#x27;house&#x27;]</td>\n",
"\n",
"\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-indicator_;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.impute.SimpleImputer.html#:~:text=indicator_,-%3Aclass%3A~sklearn.impute.MissingIndicator\">\n",
" indicator_\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-indicator_;\">\n",
" indicator_: :class:`~sklearn.impute.MissingIndicator`<br><br>Indicator used to add binary indicators for missing values.<br>`None` if `add_indicator=False`.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"fitted-att-type\">NoneType</td>\n",
" <td>None</td>\n",
"\n",
"\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-n_features_in_;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.impute.SimpleImputer.html#:~:text=n_features_in_,-int\">\n",
" n_features_in_\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-n_features_in_;\">\n",
" n_features_in_: int<br><br>Number of features seen during :term:`fit`.<br><br>.. versionadded:: 0.24</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"fitted-att-type\">int</td>\n",
" <td>3</td>\n",
"\n",
"\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-statistics_;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.impute.SimpleImputer.html#:~:text=statistics_,-array%20of%20shape%20%28n_features%2C%29\">\n",
" statistics_\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-statistics_;\">\n",
" statistics_: array of shape (n_features,)<br><br>The imputation fill value for each feature.<br>Computing statistics can result in `np.nan` values.<br>During :meth:`transform`, features corresponding to `np.nan`<br>statistics will be discarded.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"fitted-att-type\">ndarray[object](3,)</td>\n",
" <td>[&#x27;Ser&#x27;,&#x27;Northmen&#x27;,&quot;Night&#x27;s Watch&quot;]</td>\n",
"\n",
"\n",
" </tr>\n",
" \n",
" </tbody>\n",
" </table>\n",
" </details>\n",
" </div>\n",
" </div></div></div>\n",
" <div class=\"features fitted\">\n",
" <details>\n",
" <summary>\n",
" <div class=\"arrow\"></div>\n",
" <div>3 features</div>\n",
" <div class=\"image-container\" title=\"Copy all output features\">\n",
" <i class=\"copy-paste-icon\"\n",
" onclick=\"\n",
" event.stopPropagation();\n",
" event.preventDefault();\n",
" copyFeatureNamesToClipboard(this);\n",
" \"\n",
" >\n",
" </i>\n",
" </div>\n",
" </summary>\n",
" <div class=\"features-container\">\n",
" <table class=\"features-table\">\n",
" <tbody>\n",
" \n",
" <tr>\n",
" <td>title</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>culture</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>house</td>\n",
" </tr>\n",
"\n",
" \n",
" </tbody>\n",
" </table>\n",
" </div>\n",
" </details>\n",
" </div>\n",
" <div class=\"sk-item\"><div class=\"sk-estimator fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually sk-global\" id=\"sk-estimator-id-8\" type=\"checkbox\" ><label for=\"sk-estimator-id-8\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow\"><div><div>OneHotEncoder</div></div><div><a class=\"sk-estimator-doc-link fitted\" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.preprocessing.OneHotEncoder.html\">?<span>Documentation for OneHotEncoder</span></a></div></label><div class=\"sk-toggleable__content fitted\" data-param-prefix=\"preprocessor__cat__onehot__\">\n",
" <div class=\"estimator-table\">\n",
" <details>\n",
" <summary>Parameters</summary>\n",
" <table class=\"parameters-table\">\n",
" <tbody>\n",
" \n",
" <tr class=\"user-set\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('handle_unknown',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-handle_unknown;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.preprocessing.OneHotEncoder.html#:~:text=handle_unknown,-%7B%27error%27%2C%20%27ignore%27%2C%20%27infrequent_if_exist%27%2C%20%27warn%27%7D%2C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20default%3D%27error%27\">\n",
" handle_unknown\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-handle_unknown;\">\n",
" handle_unknown: {&#x27;error&#x27;, &#x27;ignore&#x27;, &#x27;infrequent_if_exist&#x27;, &#x27;warn&#x27;}, default=&#x27;error&#x27;<br><br>Specifies the way unknown categories are handled during :meth:`transform`.<br><br>- &#x27;error&#x27; : Raise an error if an unknown category is present during transform.<br>- &#x27;ignore&#x27; : When an unknown category is encountered during<br> transform, the resulting one-hot encoded columns for this feature<br> will be all zeros. In the inverse transform, an unknown category<br> will be denoted as None.<br>- &#x27;infrequent_if_exist&#x27; : When an unknown category is encountered<br> during transform, the resulting one-hot encoded columns for this<br> feature will map to the infrequent category if it exists. The<br> infrequent category will be mapped to the last position in the<br> encoding. During inverse transform, an unknown category will be<br> mapped to the category denoted `&#x27;infrequent&#x27;` if it exists. If the<br> `&#x27;infrequent&#x27;` category does not exist, then :meth:`transform` and<br> :meth:`inverse_transform` will handle an unknown category as with<br> `handle_unknown=&#x27;ignore&#x27;`. Infrequent categories exist based on<br> `min_frequency` and `max_categories`. Read more in the<br> :ref:`User Guide &lt;encoder_infrequent_categories&gt;`.<br>- &#x27;warn&#x27; : When an unknown category is encountered during transform<br> a warning is issued, and the encoding then proceeds as described for<br> `handle_unknown=&quot;infrequent_if_exist&quot;`.<br><br>.. versionchanged:: 1.1<br> `&#x27;infrequent_if_exist&#x27;` was added to automatically handle unknown<br> categories and infrequent categories.<br><br>.. versionadded:: 1.6<br> The option `&quot;warn&quot;` was added in 1.6.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">&#x27;ignore&#x27;</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('categories',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-categories;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.preprocessing.OneHotEncoder.html#:~:text=categories,-%27auto%27%20or%20a%20list%20of%20array-like%2C%20default%3D%27auto%27\">\n",
" categories\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-categories;\">\n",
" categories: &#x27;auto&#x27; or a list of array-like, default=&#x27;auto&#x27;<br><br>Categories (unique values) per feature:<br><br>- &#x27;auto&#x27; : Determine categories automatically from the training data.<br>- list : ``categories[i]`` holds the categories expected in the ith<br> column. The passed categories should not mix strings and numeric<br> values within a single feature, and should be sorted in case of<br> numeric values.<br><br>The used categories can be found in the ``categories_`` attribute.<br><br>.. versionadded:: 0.20</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">&#x27;auto&#x27;</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('drop',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-drop;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.preprocessing.OneHotEncoder.html#:~:text=drop,-%7B%27first%27%2C%20%27if_binary%27%7D%20or%20an%20array-like%20of%20shape%20%28n_features%2C%29%2C%20%20%20%20%20%20%20%20%20%20%20%20%20default%3DNone\">\n",
" drop\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-drop;\">\n",
" drop: {&#x27;first&#x27;, &#x27;if_binary&#x27;} or an array-like of shape (n_features,), default=None<br><br>Specifies a methodology to use to drop one of the categories per<br>feature. This is useful in situations where perfectly collinear<br>features cause problems, such as when feeding the resulting data<br>into an unregularized linear regression model.<br><br>However, dropping one category breaks the symmetry of the original<br>representation and can therefore induce a bias in downstream models,<br>for instance for penalized linear classification or regression models.<br><br>- None : retain all features (the default).<br>- &#x27;first&#x27; : drop the first category in each feature. If only one<br> category is present, the feature will be dropped entirely.<br>- &#x27;if_binary&#x27; : drop the first category in each feature with two<br> categories. Features with 1 or more than 2 categories are<br> left intact.<br>- array : ``drop[i]`` is the category in feature ``X[:, i]`` that<br> should be dropped.<br><br>When `max_categories` or `min_frequency` is configured to group<br>infrequent categories, the dropping behavior is handled after the<br>grouping.<br><br>.. versionadded:: 0.21<br> The parameter `drop` was added in 0.21.<br><br>.. versionchanged:: 0.23<br> The option `drop=&#x27;if_binary&#x27;` was added in 0.23.<br><br>.. versionchanged:: 1.1<br> Support for dropping infrequent categories.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">None</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('sparse_output',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-sparse_output;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.preprocessing.OneHotEncoder.html#:~:text=sparse_output,-bool%2C%20default%3DTrue\">\n",
" sparse_output\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-sparse_output;\">\n",
" sparse_output: bool, default=True<br><br>When ``True``, it returns a SciPy sparse matrix/array<br>in &quot;Compressed Sparse Row&quot; (CSR) format.<br><br>.. versionadded:: 1.2<br> `sparse` was renamed to `sparse_output`</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">True</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('dtype',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-dtype;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.preprocessing.OneHotEncoder.html#:~:text=dtype,-number%20type%2C%20default%3Dnp.float64\">\n",
" dtype\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-dtype;\">\n",
" dtype: number type, default=np.float64<br><br>Desired dtype of output.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">&lt;class &#x27;numpy.float64&#x27;&gt;</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('min_frequency',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-min_frequency;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.preprocessing.OneHotEncoder.html#:~:text=min_frequency,-int%20or%20float%2C%20default%3DNone\">\n",
" min_frequency\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-min_frequency;\">\n",
" min_frequency: int or float, default=None<br><br>Specifies the minimum frequency below which a category will be<br>considered infrequent.<br><br>- If `int`, categories with a smaller cardinality will be considered<br> infrequent.<br><br>- If `float`, categories with a smaller cardinality than<br> `min_frequency * n_samples` will be considered infrequent.<br><br>.. versionadded:: 1.1<br> Read more in the :ref:`User Guide &lt;encoder_infrequent_categories&gt;`.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">None</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('max_categories',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-max_categories;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.preprocessing.OneHotEncoder.html#:~:text=max_categories,-int%2C%20default%3DNone\">\n",
" max_categories\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-max_categories;\">\n",
" max_categories: int, default=None<br><br>Specifies an upper limit to the number of output features for each input<br>feature when considering infrequent categories. If there are infrequent<br>categories, `max_categories` includes the category representing the<br>infrequent categories along with the frequent categories. If `None`,<br>there is no limit to the number of output features.<br><br>.. versionadded:: 1.1<br> Read more in the :ref:`User Guide &lt;encoder_infrequent_categories&gt;`.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">None</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('feature_name_combiner',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-feature_name_combiner;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.preprocessing.OneHotEncoder.html#:~:text=feature_name_combiner,-%22concat%22%20or%20callable%2C%20default%3D%22concat%22\">\n",
" feature_name_combiner\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-feature_name_combiner;\">\n",
" feature_name_combiner: &quot;concat&quot; or callable, default=&quot;concat&quot;<br><br>Callable with signature `def callable(input_feature, category)` that returns a<br>string. This is used to create feature names to be returned by<br>:meth:`get_feature_names_out`.<br><br>`&quot;concat&quot;` concatenates encoded feature name and category with<br>`feature + &quot;_&quot; + str(category)`.E.g. feature X with values 1, 6, 7 create<br>feature names `X_1, X_6, X_7`.<br><br>.. versionadded:: 1.3</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">&#x27;concat&#x27;</td>\n",
" </tr>\n",
" \n",
" </tbody>\n",
" </table>\n",
" </details>\n",
" </div>\n",
" \n",
" <div class=\"estimator-table\">\n",
" <details>\n",
" <summary>Fitted attributes</summary>\n",
" <table class=\"parameters-table\">\n",
" <tbody>\n",
" <tr>\n",
" <th>Name</th>\n",
" <th>Type</th>\n",
" <th>Value</th>\n",
" </tr>\n",
" \n",
" <tr class=\"default\">\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-categories_;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.preprocessing.OneHotEncoder.html#:~:text=categories_,-list%20of%20arrays\">\n",
" categories_\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-categories_;\">\n",
" categories_: list of arrays<br><br>The categories of each feature determined during fitting<br>(in order of the features in X and corresponding with the output<br>of ``transform``). This includes the category specified in ``drop``<br>(if any).</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"fitted-att-type\">list</td>\n",
" <td>[array([&#x27;Acorn... dtype=object), array([&#x27;Andal... dtype=object), array([&quot;Alche... dtype=object)]</td>\n",
"\n",
"\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-drop_idx_;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.preprocessing.OneHotEncoder.html#:~:text=drop_idx_,-array%20of%20shape%20%28n_features%2C%29\">\n",
" drop_idx_\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-drop_idx_;\">\n",
" drop_idx_: array of shape (n_features,)<br><br>- ``drop_idx_[i]`` is the index in ``categories_[i]`` of the category<br> to be dropped for each feature.<br>- ``drop_idx_[i] = None`` if no category is to be dropped from the<br> feature with index ``i``, e.g. when `drop=&#x27;if_binary&#x27;` and the<br> feature isn&#x27;t binary.<br>- ``drop_idx_ = None`` if all the transformed features will be<br> retained.<br><br>If infrequent categories are enabled by setting `min_frequency` or<br>`max_categories` to a non-default value and `drop_idx[i]` corresponds<br>to an infrequent category, then the entire infrequent category is<br>dropped.<br><br>.. versionchanged:: 0.23<br> Added the possibility to contain `None` values.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"fitted-att-type\">NoneType</td>\n",
" <td>None</td>\n",
"\n",
"\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-n_features_in_;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.preprocessing.OneHotEncoder.html#:~:text=n_features_in_,-int\">\n",
" n_features_in_\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-n_features_in_;\">\n",
" n_features_in_: int<br><br>Number of features seen during :term:`fit`.<br><br>.. versionadded:: 1.0</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"fitted-att-type\">int</td>\n",
" <td>3</td>\n",
"\n",
"\n",
" </tr>\n",
" \n",
" </tbody>\n",
" </table>\n",
" </details>\n",
" </div>\n",
" </div></div></div>\n",
" <div class=\"features fitted\">\n",
" <details>\n",
" <summary>\n",
" <div class=\"arrow\"></div>\n",
" <div>569 features</div>\n",
" <div class=\"image-container\" title=\"Copy all output features\">\n",
" <i class=\"copy-paste-icon\"\n",
" onclick=\"\n",
" event.stopPropagation();\n",
" event.preventDefault();\n",
" copyFeatureNamesToClipboard(this);\n",
" \"\n",
" >\n",
" </i>\n",
" </div>\n",
" </summary>\n",
" <div class=\"features-container\">\n",
" <table class=\"features-table\">\n",
" <tbody>\n",
" \n",
" <tr>\n",
" <td>x0_Acorn Hall</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Andals</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Arbor</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Archmaester</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Ashford</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Barrowton</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Bear Island</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Big BucketThe Wull</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Bitterbridge</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Blackcrown</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Blackmont</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Bloodrider</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Blue Grace</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Brightwater</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Broad Arch</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Brother</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Captain</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Captain of the guard</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Captain-General</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Castellan</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_CastellanCommander</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Casterly Rock</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Castle Lychester</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Cerwyn</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Cobblecat</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Coldmoat</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Coldwater Burn</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Commander of the City Watch</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Commander of the Second Sons</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Crag</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Crakehall</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Cupbearer</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Darry</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Deepwood Motte</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Dreadfort</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Duskendale</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Dyre Den</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Eastwatch-by-the-Sea</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Eyrie</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Fair Isle</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Feastfires</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Felwood</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_First Ranger</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_First Sword of Braavos</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Foamdrinker</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Ghost Hill</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Godswife</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Golden Tooth</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Goldengrove</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Goldgrass</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Good Master</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Goodman</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Goodwife</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Grand Maester</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Grassy Vale</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Greenshield</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Greenstone</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Grey Glen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Greywater Watch</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Gulltown</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Hand of the King</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Harlaw</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Harrenhal</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Harridan Hill</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Hayford</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Haystack Hall</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Heart&#x27;s Home</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_High Septon</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_High Steward of Highgarden</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Highgarden</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Hightower</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Horn Hill</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Hornvale</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Hornwood</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Ironoaks</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Karhold</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Kayce</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Keeper of the Gates of the Moon</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Khal</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_KhalKo (formerly)</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Khalakka</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_King</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_King in the North</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_King of Winter</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_King of the Andals</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_King-Beyond-the-Wall</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Knight</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Knight of Griffin&#x27;s Roost</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lady</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lady of Bear Island</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lady of Darry</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lady of Torrhen&#x27;s Square</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lady of the Vale</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_LadyQueen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_LadyQueenDowager Queen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Last Hearth</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Light of the West</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lonely Light</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Longsister</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Longtable</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lord</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lord Captain of the Iron Fleet</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lord Commander of the Night&#x27;s Watch</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lord Paramount of the Mander</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lord Paramount of the Trident</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lord Reaper of Pyke</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lord Seneschal</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lord Steward</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lord of Blackhaven</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lord of Coldmoat</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lord of Crows Nest</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lord of Dragonstone</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lord of Flint&#x27;s Finger</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lord of Greyshield</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lord of Griffin&#x27;s Roost</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lord of Hammerhorn</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lord of Harrenhal</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lord of Oakenshield</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lord of Oldcastle</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lord of Pebbleton</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lord of Starfall</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lord of Sunflower Hall</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lord of the Crossing</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lord of the Deep Den</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lord of the Hornwood</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lord of the Iron Islands</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lord of the Marches</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lord of the Red Dunes</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lord of the Seven Kingdoms</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lord of the Snakewood</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lord of the Ten TowersLord Harlaw of HarlawHarlaw of Harlaw</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Lord of the Tides</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Maester</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Magister</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Maidenpool</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Master of Coin</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Master of Deepwood Motte</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Master of Harlaw Hall</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Master of coin</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Master of whisperers</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Master-at-Arms</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Mistress of whisperers</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Nightsong</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Oarmaster</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Old Oak</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Old Wyk</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Prince</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Prince of Dorne</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Prince of Dragonstone</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Prince of Winterfell</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Prince of WinterfellHeir to Winterfell</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Prince of the Narrow Sea</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Princess</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_PrincessQueen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_PrincessQueenDowager Queen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Protector of the Realm</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Queen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_QueenDowager Queen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Red Flower Vale</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Redfort</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Rills</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Riverrun</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Rook&#x27;s Rest</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Ruddy Hall</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Runestone</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Salt Shore</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Sandship</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Sealord</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Sealskin Point</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Seneschal</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Septa</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Septon</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Ser</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_SerCastellan of Casterly Rock</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Seven Kingdoms</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Sharp Point</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Shatterstone</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Slave of R&#x27;hllor</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Starpike</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Steward</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Stokeworth</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Stonehelm</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Storm&#x27;s End</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Sunspear</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Ten Towers</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_The LiddleLord Liddle</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_The NorreyLord Norrey</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Three Towers</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Tower of Glimmering</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Tradesman-Captain</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Twins</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Uplands</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Volmark</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Warlock</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Whitewalls</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Widow&#x27;s Watch</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Winterfell</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Wisdom</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_Wraith</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_[1]</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_green lands</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_master of ships</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_red hand</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_the Crossing</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x0_the Dreadfort</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Andal</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Andals</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Asshai</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Asshai&#x27;i</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Astapor</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Astapori</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Braavosi</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Crannogmen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Dorne</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Dornish</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Dornishmen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Dothraki</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_First Men</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Free Folk</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Free folk</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Ghiscari</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Ghiscaricari</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Ironborn</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Ironmen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Lhazareen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Lhazarene</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Lysene</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Lyseni</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Meereen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Meereenese</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Myrish</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Northern mountain clans</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Northmen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Norvos</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Norvoshi</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Pentoshi</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Qarth</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Qartheen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Qohor</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Reach</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Reachmen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Rhoynar</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Rivermen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Sistermen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Stormlander</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Stormlands</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Summer Islander</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Summer Islands</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Summer Isles</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Tyroshi</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Vale</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Vale mountain clans</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Valemen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Valyrian</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Westerlands</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Westerman</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Westermen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Westeros</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Wildling</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_Wildlings</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_free folk</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_northmen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x1_westermen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Alchemists&#x27; Guild</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Antler Men</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Band of Nine</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Black Ears</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Blacks</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Brave Companions</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Brotherhood Without Banners</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Brotherhood without Banners</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Brotherhood without banners</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Burned Men</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Chataya&#x27;s brothel</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Citadel</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Company of the Cat</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Drowned men</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Faceless Men</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Faith of the Seven</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Golden Company</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Good Masters</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Happy Port</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Ambrose</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Arryn</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Ashford</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Baelish</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Ball</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Bar Emmon</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Baratheon</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Baratheon of Dragonstone</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Baratheon of King&#x27;s Landing</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Beesbury</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Belmore</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Bettley</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Blackberry</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Blackfyre</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Blackmont</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Blackwood</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Boggs</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Bolling</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Bolton</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Bolton of the Dreadfort</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Botley</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Bracken</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Brax</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Broom</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Brune of Brownhollow</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Brune of the Dyre Den</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Buckler</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Bulwer</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Bushy</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Butterwell</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Byrch</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Bywater</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Cafferen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Caron</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Cassel</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Caswell</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Cerwyn</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Charlton</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Chelsted</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Chester</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Clegane</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Clifton</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Cockshaw</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Codd</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Coldwater</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Condon</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Connington</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Corbray</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Costayne</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Crabb</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Crakehall</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Crane</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Cupps</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Cuy</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Dalt</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Darklyn</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Darry</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Dayne</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Dayne of High Hermitage</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Deddings</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Dondarrion</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Drumm</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Dustin</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Erenford</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Errol</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Estermont</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Farman</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Farring</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Farwynd</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Farwynd of the Lonely Light</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Fell</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Flint</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Flint of Widow&#x27;s Watch</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Florent</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Fossoway</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Fossoway of Cider Hall</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Fossoway of New Barrel</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Frey</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Frey of Riverrun</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Gargalen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Gaunt</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Glover</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Goodbrook</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Goodbrother</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Goodbrother of Shatterstone</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Graceford</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Grafton</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Greenfield</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Greenhill</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Grell</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Greyjoy</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Grimm</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Haigh</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Harclay</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Hardy</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Hardyng</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Harlaw</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Harlaw of Grey Garden</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Harlaw of Harlaw Hall</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Harlaw of Harridan Hill</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Harlaw of the Tower of Glimmering</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Hasty</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Hawick</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Hayford</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Heddle</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Hetherspoon</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Hewett</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Hightower</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Hogg</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Hollard</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Hornwood</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Horpe</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Humble</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Hunt</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Hunter</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Inchfield</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Ironmaker</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Jast</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Jordayne</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Karstark</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Kenning of Harlaw</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Kenning of Kayce</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Kettleblack</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Lannister</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Lannister of Casterly Rock</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Lannister of Lannisport</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Leek</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Lefford</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Liddle</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Locke</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Longthorpe</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Lorch</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Lothston</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Lychester</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Lydden</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Lynderly</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Mallery</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Mallister</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Manderly</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Manwoody</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Marbrand</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Martell</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Meadows</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Merlyn</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Merryweather</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Mertyns</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Mollen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Moore</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Mooton</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Moreland</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Mormont</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Morrigen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Mudd</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Mullendore</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Myre</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Nayland</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Norcross</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Norrey</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Norridge</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Nymeros Martell</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Oakheart</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Osgrey</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Paege</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Payne</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Peake</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Peckledon</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Pemford</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Penny</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Penrose</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Piper</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Plumm</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Poole</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Potter</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Prester</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Qorgyle</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Rambton</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Redfort</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Redwyne</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Reed</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Reyne</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Rhysling</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Risley</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Roote</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Rosby</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Rowan</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Royce</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Royce of the Gates of the Moon</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Ruttiger</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Ryger</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Rykker</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Ryswell</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Santagar</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Sarsfield</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Seaworth</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Selmy</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Sharp</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Shepherd</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Slynt</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Smallwood</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Sparr</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Spicer</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Stackspear</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Staedmon</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Stark</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Staunton</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Stokeworth</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Stonetree</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Stout</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Strickland</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Strong</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Suggs</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Sunglass</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Swann</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Swyft</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Tallhart</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Targaryen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Tarly</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Tarth</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Tawney</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Templeton</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Thorne</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Toland</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Tollett</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Toyne</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Tully</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Turnberry</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Tyrell</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Uffering</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Uller</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Umber</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Vaith</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Vance</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Vance of Atranta</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Vance of Wayfarer&#x27;s Rest</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Varner</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Velaryon</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Vikary</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Volmark</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Vypren</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Vyrwel</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Wagstaff</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Wayn</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Waynwood</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Weaver</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Webber</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Wells</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Westerling</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Whent</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Willum</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Woolfield</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Wull</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Wylde</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Wythers</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Yew</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House Yronwood</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House of Galare</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House of Ghazeen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House of Kandaq</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House of Loraq</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House of Pahl</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_House of Reznak</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Iron Bank of Braavos</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Khal</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Kingdom of the Three Daughters</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Kingsguard</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Kingswood Brotherhood</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Maesters</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Mance Rayder</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Moon Brothers</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Night&#x27;s Watch</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Peach</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Pureborn</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Queensguard</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_R&#x27;hllor</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Sea watch</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Second Sons</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Stone Crows</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Stormcrows</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Summer Islands</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_The Citadel</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Thirteen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Three-eyed crow</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Undying Ones</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Unsullied</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Windblown</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_Wise Masters</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>x2_wildling</td>\n",
" </tr>\n",
"\n",
" \n",
" </tbody>\n",
" </table>\n",
" </div>\n",
" </details>\n",
" </div>\n",
" </div></div></div></div></div></div><div class='total_features'>\n",
" <div class=\"features fitted\">\n",
" <details>\n",
" <summary>\n",
" <div class=\"arrow\"></div>\n",
" <div>575 features</div>\n",
" <div class=\"image-container\" title=\"Copy all output features\">\n",
" <i class=\"copy-paste-icon\"\n",
" onclick=\"\n",
" event.stopPropagation();\n",
" event.preventDefault();\n",
" copyFeatureNamesToClipboard(this);\n",
" \"\n",
" >\n",
" </i>\n",
" </div>\n",
" </summary>\n",
" <div class=\"features-container\">\n",
" <table class=\"features-table\">\n",
" <tbody>\n",
" \n",
" <tr>\n",
" <td>num__male</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>num__isMarried</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>num__isNoble</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>num__age</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>num__numDeadRelations</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>num__popularity</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Acorn Hall</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Andals</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Arbor</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Archmaester</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Ashford</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Barrowton</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Bear Island</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Big BucketThe Wull</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Bitterbridge</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Blackcrown</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Blackmont</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Bloodrider</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Blue Grace</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Brightwater</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Broad Arch</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Brother</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Captain</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Captain of the guard</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Captain-General</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Castellan</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_CastellanCommander</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Casterly Rock</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Castle Lychester</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Cerwyn</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Cobblecat</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Coldmoat</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Coldwater Burn</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Commander of the City Watch</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Commander of the Second Sons</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Crag</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Crakehall</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Cupbearer</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Darry</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Deepwood Motte</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Dreadfort</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Duskendale</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Dyre Den</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Eastwatch-by-the-Sea</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Eyrie</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Fair Isle</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Feastfires</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Felwood</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_First Ranger</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_First Sword of Braavos</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Foamdrinker</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Ghost Hill</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Godswife</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Golden Tooth</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Goldengrove</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Goldgrass</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Good Master</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Goodman</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Goodwife</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Grand Maester</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Grassy Vale</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Greenshield</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Greenstone</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Grey Glen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Greywater Watch</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Gulltown</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Hand of the King</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Harlaw</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Harrenhal</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Harridan Hill</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Hayford</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Haystack Hall</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Heart&#x27;s Home</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_High Septon</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_High Steward of Highgarden</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Highgarden</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Hightower</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Horn Hill</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Hornvale</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Hornwood</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Ironoaks</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Karhold</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Kayce</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Keeper of the Gates of the Moon</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Khal</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_KhalKo (formerly)</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Khalakka</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_King</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_King in the North</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_King of Winter</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_King of the Andals</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_King-Beyond-the-Wall</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Knight</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Knight of Griffin&#x27;s Roost</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lady</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lady of Bear Island</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lady of Darry</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lady of Torrhen&#x27;s Square</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lady of the Vale</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_LadyQueen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_LadyQueenDowager Queen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Last Hearth</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Light of the West</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lonely Light</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Longsister</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Longtable</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lord</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lord Captain of the Iron Fleet</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lord Commander of the Night&#x27;s Watch</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lord Paramount of the Mander</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lord Paramount of the Trident</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lord Reaper of Pyke</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lord Seneschal</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lord Steward</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lord of Blackhaven</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lord of Coldmoat</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lord of Crows Nest</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lord of Dragonstone</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lord of Flint&#x27;s Finger</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lord of Greyshield</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lord of Griffin&#x27;s Roost</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lord of Hammerhorn</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lord of Harrenhal</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lord of Oakenshield</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lord of Oldcastle</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lord of Pebbleton</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lord of Starfall</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lord of Sunflower Hall</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lord of the Crossing</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lord of the Deep Den</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lord of the Hornwood</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lord of the Iron Islands</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lord of the Marches</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lord of the Red Dunes</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lord of the Seven Kingdoms</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lord of the Snakewood</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lord of the Ten TowersLord Harlaw of HarlawHarlaw of Harlaw</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Lord of the Tides</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Maester</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Magister</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Maidenpool</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Master of Coin</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Master of Deepwood Motte</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Master of Harlaw Hall</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Master of coin</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Master of whisperers</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Master-at-Arms</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Mistress of whisperers</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Nightsong</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Oarmaster</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Old Oak</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Old Wyk</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Prince</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Prince of Dorne</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Prince of Dragonstone</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Prince of Winterfell</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Prince of WinterfellHeir to Winterfell</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Prince of the Narrow Sea</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Princess</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_PrincessQueen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_PrincessQueenDowager Queen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Protector of the Realm</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Queen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_QueenDowager Queen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Red Flower Vale</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Redfort</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Rills</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Riverrun</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Rook&#x27;s Rest</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Ruddy Hall</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Runestone</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Salt Shore</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Sandship</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Sealord</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Sealskin Point</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Seneschal</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Septa</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Septon</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Ser</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_SerCastellan of Casterly Rock</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Seven Kingdoms</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Sharp Point</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Shatterstone</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Slave of R&#x27;hllor</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Starpike</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Steward</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Stokeworth</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Stonehelm</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Storm&#x27;s End</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Sunspear</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Ten Towers</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_The LiddleLord Liddle</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_The NorreyLord Norrey</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Three Towers</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Tower of Glimmering</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Tradesman-Captain</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Twins</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Uplands</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Volmark</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Warlock</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Whitewalls</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Widow&#x27;s Watch</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Winterfell</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Wisdom</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_Wraith</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_[1]</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_green lands</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_master of ships</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_red hand</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_the Crossing</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__title_the Dreadfort</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Andal</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Andals</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Asshai</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Asshai&#x27;i</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Astapor</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Astapori</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Braavosi</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Crannogmen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Dorne</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Dornish</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Dornishmen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Dothraki</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_First Men</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Free Folk</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Free folk</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Ghiscari</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Ghiscaricari</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Ironborn</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Ironmen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Lhazareen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Lhazarene</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Lysene</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Lyseni</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Meereen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Meereenese</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Myrish</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Northern mountain clans</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Northmen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Norvos</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Norvoshi</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Pentoshi</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Qarth</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Qartheen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Qohor</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Reach</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Reachmen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Rhoynar</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Rivermen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Sistermen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Stormlander</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Stormlands</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Summer Islander</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Summer Islands</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Summer Isles</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Tyroshi</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Vale</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Vale mountain clans</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Valemen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Valyrian</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Westerlands</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Westerman</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Westermen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Westeros</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Wildling</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_Wildlings</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_free folk</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_northmen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__culture_westermen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Alchemists&#x27; Guild</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Antler Men</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Band of Nine</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Black Ears</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Blacks</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Brave Companions</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Brotherhood Without Banners</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Brotherhood without Banners</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Brotherhood without banners</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Burned Men</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Chataya&#x27;s brothel</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Citadel</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Company of the Cat</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Drowned men</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Faceless Men</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Faith of the Seven</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Golden Company</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Good Masters</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Happy Port</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Ambrose</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Arryn</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Ashford</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Baelish</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Ball</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Bar Emmon</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Baratheon</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Baratheon of Dragonstone</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Baratheon of King&#x27;s Landing</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Beesbury</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Belmore</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Bettley</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Blackberry</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Blackfyre</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Blackmont</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Blackwood</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Boggs</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Bolling</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Bolton</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Bolton of the Dreadfort</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Botley</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Bracken</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Brax</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Broom</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Brune of Brownhollow</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Brune of the Dyre Den</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Buckler</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Bulwer</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Bushy</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Butterwell</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Byrch</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Bywater</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Cafferen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Caron</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Cassel</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Caswell</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Cerwyn</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Charlton</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Chelsted</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Chester</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Clegane</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Clifton</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Cockshaw</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Codd</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Coldwater</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Condon</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Connington</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Corbray</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Costayne</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Crabb</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Crakehall</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Crane</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Cupps</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Cuy</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Dalt</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Darklyn</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Darry</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Dayne</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Dayne of High Hermitage</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Deddings</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Dondarrion</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Drumm</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Dustin</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Erenford</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Errol</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Estermont</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Farman</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Farring</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Farwynd</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Farwynd of the Lonely Light</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Fell</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Flint</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Flint of Widow&#x27;s Watch</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Florent</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Fossoway</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Fossoway of Cider Hall</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Fossoway of New Barrel</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Frey</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Frey of Riverrun</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Gargalen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Gaunt</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Glover</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Goodbrook</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Goodbrother</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Goodbrother of Shatterstone</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Graceford</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Grafton</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Greenfield</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Greenhill</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Grell</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Greyjoy</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Grimm</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Haigh</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Harclay</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Hardy</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Hardyng</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Harlaw</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Harlaw of Grey Garden</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Harlaw of Harlaw Hall</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Harlaw of Harridan Hill</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Harlaw of the Tower of Glimmering</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Hasty</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Hawick</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Hayford</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Heddle</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Hetherspoon</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Hewett</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Hightower</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Hogg</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Hollard</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Hornwood</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Horpe</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Humble</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Hunt</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Hunter</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Inchfield</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Ironmaker</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Jast</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Jordayne</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Karstark</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Kenning of Harlaw</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Kenning of Kayce</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Kettleblack</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Lannister</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Lannister of Casterly Rock</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Lannister of Lannisport</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Leek</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Lefford</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Liddle</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Locke</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Longthorpe</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Lorch</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Lothston</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Lychester</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Lydden</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Lynderly</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Mallery</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Mallister</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Manderly</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Manwoody</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Marbrand</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Martell</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Meadows</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Merlyn</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Merryweather</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Mertyns</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Mollen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Moore</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Mooton</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Moreland</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Mormont</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Morrigen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Mudd</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Mullendore</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Myre</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Nayland</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Norcross</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Norrey</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Norridge</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Nymeros Martell</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Oakheart</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Osgrey</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Paege</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Payne</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Peake</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Peckledon</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Pemford</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Penny</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Penrose</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Piper</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Plumm</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Poole</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Potter</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Prester</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Qorgyle</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Rambton</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Redfort</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Redwyne</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Reed</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Reyne</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Rhysling</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Risley</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Roote</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Rosby</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Rowan</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Royce</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Royce of the Gates of the Moon</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Ruttiger</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Ryger</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Rykker</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Ryswell</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Santagar</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Sarsfield</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Seaworth</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Selmy</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Sharp</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Shepherd</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Slynt</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Smallwood</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Sparr</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Spicer</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Stackspear</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Staedmon</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Stark</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Staunton</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Stokeworth</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Stonetree</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Stout</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Strickland</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Strong</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Suggs</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Sunglass</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Swann</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Swyft</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Tallhart</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Targaryen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Tarly</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Tarth</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Tawney</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Templeton</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Thorne</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Toland</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Tollett</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Toyne</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Tully</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Turnberry</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Tyrell</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Uffering</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Uller</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Umber</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Vaith</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Vance</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Vance of Atranta</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Vance of Wayfarer&#x27;s Rest</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Varner</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Velaryon</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Vikary</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Volmark</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Vypren</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Vyrwel</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Wagstaff</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Wayn</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Waynwood</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Weaver</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Webber</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Wells</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Westerling</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Whent</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Willum</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Woolfield</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Wull</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Wylde</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Wythers</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Yew</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House Yronwood</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House of Galare</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House of Ghazeen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House of Kandaq</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House of Loraq</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House of Pahl</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_House of Reznak</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Iron Bank of Braavos</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Khal</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Kingdom of the Three Daughters</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Kingsguard</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Kingswood Brotherhood</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Maesters</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Mance Rayder</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Moon Brothers</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Night&#x27;s Watch</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Peach</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Pureborn</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Queensguard</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_R&#x27;hllor</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Sea watch</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Second Sons</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Stone Crows</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Stormcrows</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Summer Islands</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_The Citadel</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Thirteen</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Three-eyed crow</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Undying Ones</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Unsullied</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Windblown</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_Wise Masters</td>\n",
" </tr>\n",
"\n",
" \n",
" <tr>\n",
" <td>cat__house_wildling</td>\n",
" </tr>\n",
"\n",
" \n",
" </tbody>\n",
" </table>\n",
" </div>\n",
" </details>\n",
" </div>\n",
" </div></div><div class=\"sk-item\"><div class=\"sk-estimator fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually sk-global\" id=\"sk-estimator-id-9\" type=\"checkbox\" ><label for=\"sk-estimator-id-9\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow\"><div><div>LogisticRegression</div></div><div><a class=\"sk-estimator-doc-link fitted\" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.linear_model.LogisticRegression.html\">?<span>Documentation for LogisticRegression</span></a></div></label><div class=\"sk-toggleable__content fitted\" data-param-prefix=\"model__\">\n",
" <div class=\"estimator-table\">\n",
" <details>\n",
" <summary>Parameters</summary>\n",
" <table class=\"parameters-table\">\n",
" <tbody>\n",
" \n",
" <tr class=\"user-set\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('class_weight',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-class_weight;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.linear_model.LogisticRegression.html#:~:text=class_weight,-dict%20or%20%27balanced%27%2C%20default%3DNone\">\n",
" class_weight\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-class_weight;\">\n",
" class_weight: dict or &#x27;balanced&#x27;, default=None<br><br>Weights associated with classes in the form ``{class_label: weight}``.<br>If not given, all classes are supposed to have weight one.<br><br>The &quot;balanced&quot; mode uses the values of y to automatically adjust<br>weights inversely proportional to class frequencies in the input data<br>as ``n_samples / (n_classes * np.bincount(y))``.<br><br>Note that these weights will be multiplied with sample_weight (passed<br>through the fit method) if sample_weight is specified.<br><br>.. versionadded:: 0.17<br> *class_weight=&#x27;balanced&#x27;*</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">&#x27;balanced&#x27;</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"user-set\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('max_iter',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-max_iter;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.linear_model.LogisticRegression.html#:~:text=max_iter,-int%2C%20default%3D100\">\n",
" max_iter\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-max_iter;\">\n",
" max_iter: int, default=100<br><br>Maximum number of iterations taken for the solvers to converge.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">1000</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('penalty',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-penalty;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.linear_model.LogisticRegression.html#:~:text=penalty,-%7B%27l1%27%2C%20%27l2%27%2C%20%27elasticnet%27%2C%20None%7D%2C%20default%3D%27l2%27\">\n",
" penalty\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-penalty;\">\n",
" penalty: {&#x27;l1&#x27;, &#x27;l2&#x27;, &#x27;elasticnet&#x27;, None}, default=&#x27;l2&#x27;<br><br>Specify the norm of the penalty:<br><br>- `None`: no penalty is added;<br>- `&#x27;l2&#x27;`: add an L2 penalty term and it is the default choice;<br>- `&#x27;l1&#x27;`: add an L1 penalty term;<br>- `&#x27;elasticnet&#x27;`: both L1 and L2 penalty terms are added.<br><br>.. warning::<br> Some penalties may not work with some solvers. See the parameter<br> `solver` below, to know the compatibility between the penalty and<br> solver.<br><br>.. versionadded:: 0.19<br> l1 penalty with SAGA solver (allowing &#x27;multinomial&#x27; + L1)<br><br>.. deprecated:: 1.8<br> `penalty` was deprecated in version 1.8 and will be removed in 1.10.<br> Use `l1_ratio` and `C` instead. `l1_ratio=0` for `penalty=&#x27;l2&#x27;`,<br> `l1_ratio=1` for `penalty=&#x27;l1&#x27;`, `l1_ratio` set to any float between 0 and 1<br> for `penalty=&#x27;elasticnet&#x27;`, and `C=np.inf` for `penalty=None`.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">&#x27;deprecated&#x27;</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('C',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-C;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.linear_model.LogisticRegression.html#:~:text=C,-float%2C%20default%3D1.0\">\n",
" C\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-C;\">\n",
" C: float, default=1.0<br><br>Inverse of regularization strength; must be a positive float.<br>Like in support vector machines, smaller values specify stronger<br>regularization. `C=np.inf` results in unpenalized logistic regression.<br>For a visual example on the effect of tuning the `C` parameter<br>with an L1 penalty, see:<br>:ref:`sphx_glr_auto_examples_linear_model_plot_logistic_path.py`.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">1.0</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('l1_ratio',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-l1_ratio;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.linear_model.LogisticRegression.html#:~:text=l1_ratio,-float%2C%20default%3D0.0\">\n",
" l1_ratio\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-l1_ratio;\">\n",
" l1_ratio: float, default=0.0<br><br>The Elastic-Net mixing parameter, with `0 &lt;= l1_ratio &lt;= 1`. Setting<br>`l1_ratio=1` gives a pure L1-penalty, setting `l1_ratio=0` a pure L2-penalty.<br>Any value between 0 and 1 gives an Elastic-Net penalty of the form<br>`l1_ratio * L1 + (1 - l1_ratio) * L2`.<br><br>.. warning::<br> Certain values of `l1_ratio`, i.e. some penalties, may not work with some<br> solvers. See the parameter `solver` below, to know the compatibility between<br> the penalty and solver.<br><br>.. versionchanged:: 1.8<br> Default value changed from None to 0.0.<br><br>.. deprecated:: 1.8<br> `None` is deprecated and will be removed in version 1.10. Always use<br> `l1_ratio` to specify the penalty type.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">0.0</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('dual',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-dual;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.linear_model.LogisticRegression.html#:~:text=dual,-bool%2C%20default%3DFalse\">\n",
" dual\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-dual;\">\n",
" dual: bool, default=False<br><br>Dual (constrained) or primal (regularized, see also<br>:ref:`this equation &lt;regularized-logistic-loss&gt;`) formulation. Dual formulation<br>is only implemented for l2 penalty with liblinear solver. Prefer `dual=False`<br>when n_samples &gt; n_features.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">False</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('tol',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-tol;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.linear_model.LogisticRegression.html#:~:text=tol,-float%2C%20default%3D1e-4\">\n",
" tol\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-tol;\">\n",
" tol: float, default=1e-4<br><br>Tolerance for stopping criteria.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">0.0001</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('fit_intercept',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-fit_intercept;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.linear_model.LogisticRegression.html#:~:text=fit_intercept,-bool%2C%20default%3DTrue\">\n",
" fit_intercept\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-fit_intercept;\">\n",
" fit_intercept: bool, default=True<br><br>Specifies if a constant (a.k.a. bias or intercept) should be<br>added to the decision function.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">True</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('intercept_scaling',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-intercept_scaling;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.linear_model.LogisticRegression.html#:~:text=intercept_scaling,-float%2C%20default%3D1\">\n",
" intercept_scaling\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-intercept_scaling;\">\n",
" intercept_scaling: float, default=1<br><br>Useful only when the solver `liblinear` is used<br>and `self.fit_intercept` is set to `True`. In this case, `x` becomes<br>`[x, self.intercept_scaling]`,<br>i.e. a &quot;synthetic&quot; feature with constant value equal to<br>`intercept_scaling` is appended to the instance vector.<br>The intercept becomes<br>``intercept_scaling * synthetic_feature_weight``.<br><br>.. note::<br> The synthetic feature weight is subject to L1 or L2<br> regularization as all other features.<br> To lessen the effect of regularization on synthetic feature weight<br> (and therefore on the intercept) `intercept_scaling` has to be increased.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">1</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('random_state',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-random_state;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.linear_model.LogisticRegression.html#:~:text=random_state,-int%2C%20RandomState%20instance%2C%20default%3DNone\">\n",
" random_state\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-random_state;\">\n",
" random_state: int, RandomState instance, default=None<br><br>Used when ``solver`` == &#x27;sag&#x27;, &#x27;saga&#x27; or &#x27;liblinear&#x27; to shuffle the<br>data. See :term:`Glossary &lt;random_state&gt;` for details.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">None</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('solver',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-solver;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.linear_model.LogisticRegression.html#:~:text=solver,-%7B%27lbfgs%27%2C%20%27liblinear%27%2C%20%27newton-cg%27%2C%20%27newton-cholesky%27%2C%20%27sag%27%2C%20%27saga%27%7D%2C%20%20%20%20%20%20%20%20%20%20%20%20%20default%3D%27lbfgs%27\">\n",
" solver\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-solver;\">\n",
" solver: {&#x27;lbfgs&#x27;, &#x27;liblinear&#x27;, &#x27;newton-cg&#x27;, &#x27;newton-cholesky&#x27;, &#x27;sag&#x27;, &#x27;saga&#x27;}, default=&#x27;lbfgs&#x27;<br><br>Algorithm to use in the optimization problem. Default is &#x27;lbfgs&#x27;.<br>To choose a solver, you might want to consider the following aspects:<br><br>- &#x27;lbfgs&#x27; is a good default solver because it works reasonably well for a wide<br> class of problems.<br>- For :term:`multiclass` problems (`n_classes &gt;= 3`), all solvers except<br> &#x27;liblinear&#x27; minimize the full multinomial loss, &#x27;liblinear&#x27; will raise an<br> error.<br>- &#x27;newton-cholesky&#x27; is a good choice for<br> `n_samples` &gt;&gt; `n_features * n_classes`, especially with one-hot encoded<br> categorical features with rare categories. Be aware that the memory usage<br> of this solver has a quadratic dependency on `n_features * n_classes`<br> because it explicitly computes the full Hessian matrix.<br>- For small datasets, &#x27;liblinear&#x27; is a good choice, whereas &#x27;sag&#x27;<br> and &#x27;saga&#x27; are faster for large ones;<br>- &#x27;liblinear&#x27; can only handle binary classification by default. To apply a<br> one-versus-rest scheme for the multiclass setting one can wrap it with the<br> :class:`~sklearn.multiclass.OneVsRestClassifier`.<br><br>.. warning::<br> The choice of the algorithm depends on the penalty chosen (`l1_ratio=0`<br> for L2-penalty, `l1_ratio=1` for L1-penalty and `0 &lt; l1_ratio &lt; 1` for<br> Elastic-Net) and on (multinomial) multiclass support:<br><br> ================= ======================== ======================<br> solver l1_ratio multinomial multiclass<br> ================= ======================== ======================<br> &#x27;lbfgs&#x27; l1_ratio=0 yes<br> &#x27;liblinear&#x27; l1_ratio=1 or l1_ratio=0 no<br> &#x27;newton-cg&#x27; l1_ratio=0 yes<br> &#x27;newton-cholesky&#x27; l1_ratio=0 yes<br> &#x27;sag&#x27; l1_ratio=0 yes<br> &#x27;saga&#x27; 0&lt;=l1_ratio&lt;=1 yes<br> ================= ======================== ======================<br><br>.. note::<br> &#x27;sag&#x27; and &#x27;saga&#x27; fast convergence is only guaranteed on features<br> with approximately the same scale. You can preprocess the data with<br> a scaler from :mod:`sklearn.preprocessing`.<br><br>.. seealso::<br> Refer to the :ref:`User Guide &lt;Logistic_regression&gt;` for more<br> information regarding :class:`LogisticRegression` and more specifically the<br> :ref:`Table &lt;logistic_regression_solvers&gt;`<br> summarizing solver/penalty supports.<br><br>.. versionadded:: 0.17<br> Stochastic Average Gradient (SAG) descent solver. Multinomial support in<br> version 0.18.<br>.. versionadded:: 0.19<br> SAGA solver.<br>.. versionchanged:: 0.22<br> The default solver changed from &#x27;liblinear&#x27; to &#x27;lbfgs&#x27; in 0.22.<br>.. versionadded:: 1.2<br> newton-cholesky solver. Multinomial support in version 1.6.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">&#x27;lbfgs&#x27;</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('verbose',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-verbose;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.linear_model.LogisticRegression.html#:~:text=verbose,-int%2C%20default%3D0\">\n",
" verbose\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-verbose;\">\n",
" verbose: int, default=0<br><br>For the liblinear and lbfgs solvers set verbose to any positive<br>number for verbosity.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">0</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('warm_start',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-warm_start;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.linear_model.LogisticRegression.html#:~:text=warm_start,-bool%2C%20default%3DFalse\">\n",
" warm_start\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-warm_start;\">\n",
" warm_start: bool, default=False<br><br>When set to True, reuse the solution of the previous call to fit as<br>initialization, otherwise, just erase the previous solution.<br>Useless for liblinear solver. See :term:`the Glossary &lt;warm_start&gt;`.<br><br>.. versionadded:: 0.17<br> *warm_start* to support *lbfgs*, *newton-cg*, *sag*, *saga* solvers.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">False</td>\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td><i class=\"copy-paste-icon\"\n",
" onclick=\"copyToClipboard('n_jobs',\n",
" this.parentElement.nextElementSibling)\"\n",
" ></i></td>\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-n_jobs;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.linear_model.LogisticRegression.html#:~:text=n_jobs,-int%2C%20default%3DNone\">\n",
" n_jobs\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-n_jobs;\">\n",
" n_jobs: int, default=None<br><br>Does not have any effect.<br><br>.. deprecated:: 1.8<br> `n_jobs` is deprecated in version 1.8 and will be removed in 1.10.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"value\">None</td>\n",
" </tr>\n",
" \n",
" </tbody>\n",
" </table>\n",
" </details>\n",
" </div>\n",
" \n",
" <div class=\"estimator-table\">\n",
" <details>\n",
" <summary>Fitted attributes</summary>\n",
" <table class=\"parameters-table\">\n",
" <tbody>\n",
" <tr>\n",
" <th>Name</th>\n",
" <th>Type</th>\n",
" <th>Value</th>\n",
" </tr>\n",
" \n",
" <tr class=\"default\">\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-classes_;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.linear_model.LogisticRegression.html#:~:text=classes_,-ndarray%20of%20shape%20%28n_classes%2C%20%29\">\n",
" classes_\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-classes_;\">\n",
" classes_: ndarray of shape (n_classes, )<br><br>A list of class labels known to the classifier.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"fitted-att-type\">ndarray[int64](2,)</td>\n",
" <td>[0,1]</td>\n",
"\n",
"\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-coef_;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.linear_model.LogisticRegression.html#:~:text=coef_,-ndarray%20or%20CSR%20matrix%20of%20shape%20%281%2C%20n_features%29%20or%20%28n_classes%2C%20n_features%29\">\n",
" coef_\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-coef_;\">\n",
" coef_: ndarray or CSR matrix of shape (1, n_features) or (n_classes, n_features)<br><br>Coefficients of the features in the decision function.<br><br>`coef_` is of shape (1, n_features) when the given problem is binary.<br><br>By default, it will be created as a dense array, but can be turned to<br>sparse (CSR format) through :meth:`sparsify` (which can be beneficial<br>under L1 regularization when many coefficients are zero), and back to<br>dense through :meth:`densify`.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"fitted-att-type\">ndarray[float64](1, 575)</td>\n",
" <td>[[ 0.37,-0.04, 0.06,...,-0.26,-0.11, 0.73]]</td>\n",
"\n",
"\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-intercept_;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.linear_model.LogisticRegression.html#:~:text=intercept_,-ndarray%20of%20shape%20%281%2C%29%20or%20%28n_classes%2C%29\">\n",
" intercept_\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-intercept_;\">\n",
" intercept_: ndarray of shape (1,) or (n_classes,)<br><br>Intercept (a.k.a. bias) added to the decision function.<br><br>If `fit_intercept` is set to False, the intercept is set to zero.<br>`intercept_` is of shape (1,) when the given problem is binary.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"fitted-att-type\">ndarray[float64](1,)</td>\n",
" <td>[-0.81]</td>\n",
"\n",
"\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-n_features_in_;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.linear_model.LogisticRegression.html#:~:text=n_features_in_,-int\">\n",
" n_features_in_\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-n_features_in_;\">\n",
" n_features_in_: int<br><br>Number of features seen during :term:`fit`.<br><br>.. versionadded:: 0.24</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"fitted-att-type\">int</td>\n",
" <td>575</td>\n",
"\n",
"\n",
" </tr>\n",
" \n",
"\n",
" <tr class=\"default\">\n",
" <td class=\"param\">\n",
" <a class=\"param-doc-link\"\n",
" style=\"anchor-name: --doc-link-n_iter_;\"\n",
" rel=\"noreferrer\" target=\"_blank\" href=\"https://scikit-learn.org/1.9/modules/generated/sklearn.linear_model.LogisticRegression.html#:~:text=n_iter_,-ndarray%20of%20shape%20%281%2C%20%29\">\n",
" n_iter_\n",
" <span class=\"param-doc-description\"\n",
" style=\"position-anchor: --doc-link-n_iter_;\">\n",
" n_iter_: ndarray of shape (1, )<br><br>Actual number of iterations for all classes.<br><br>.. versionchanged:: 0.20<br><br> In SciPy &lt;= 1.0.0 the number of lbfgs iterations may exceed<br> ``max_iter``. ``n_iter_`` will now report at most ``max_iter``.</span>\n",
" </a>\n",
" </td>\n",
" <td class=\"fitted-att-type\">ndarray[int32](1,)</td>\n",
" <td>[58]</td>\n",
"\n",
"\n",
" </tr>\n",
" \n",
" </tbody>\n",
" </table>\n",
" </details>\n",
" </div>\n",
" </div></div></div></div></div></div></div><script>/* Authors: The scikit-learn developers\n",
" SPDX-License-Identifier: BSD-3-Clause\n",
"*/\n",
"\n",
"function copyToClipboard(text, element) {\n",
" // Get the parameter prefix from the closest toggleable content\n",
" const toggleableContent = element.closest('.sk-toggleable__content');\n",
" const paramPrefix = toggleableContent ? toggleableContent.dataset.paramPrefix : '';\n",
" const fullParamName = paramPrefix ? `${paramPrefix}${text}` : text;\n",
"\n",
" const originalStyle = element.style;\n",
" const computedStyle = window.getComputedStyle(element);\n",
" const originalWidth = computedStyle.width;\n",
" const originalHTML = element.innerHTML.replace('Copied!', '');\n",
"\n",
" navigator.clipboard.writeText(fullParamName)\n",
" .then(() => {\n",
" element.style.width = originalWidth;\n",
" element.style.color = 'green';\n",
" element.innerHTML = \"Copied!\";\n",
"\n",
" setTimeout(() => {\n",
" element.innerHTML = originalHTML;\n",
" element.style = originalStyle;\n",
" }, 2000);\n",
" })\n",
" .catch(err => {\n",
" console.error('Failed to copy:', err);\n",
" element.style.color = 'red';\n",
" element.innerHTML = \"Failed!\";\n",
" setTimeout(() => {\n",
" element.innerHTML = originalHTML;\n",
" element.style = originalStyle;\n",
" }, 2000);\n",
" });\n",
" return false;\n",
"}\n",
"\n",
"document.querySelectorAll('.copy-paste-icon').forEach(function(element) {\n",
" const toggleableContent = element.closest('.sk-toggleable__content');\n",
" const paramPrefix = toggleableContent ? toggleableContent.dataset.paramPrefix : '';\n",
"\n",
" const parent = element.parentElement;\n",
" if (!parent || !parent.nextElementSibling) {\n",
" console.warn('Expected copy-paste icon is missing from the DOM structure');\n",
" return;\n",
" }\n",
"\n",
" const paramName = element.parentElement.nextElementSibling\n",
" .textContent.trim().split(' ')[0];\n",
" const fullParamName = paramPrefix ? `${paramPrefix}${paramName}` : paramName;\n",
"\n",
" element.setAttribute('title', fullParamName);\n",
"});\n",
"\n",
"/**\n",
" * Copy the list of feature names formatted as a Python list.\n",
" *\n",
" * @param {HTMLElement} element - The copy button inside a `.features` block; its siblings\n",
" * contain a `details` element and a table containing feature named.\n",
" * @returns {boolean} Always returns `false` so callers can prevent the default click behavior.\n",
" */\n",
"function copyFeatureNamesToClipboard(element) {\n",
" var detailsElem = element.closest('.features').querySelector('details');\n",
" var wasOpen = detailsElem.open;\n",
" detailsElem.open = true;\n",
" var content = element.closest('.features').querySelector('tbody')\n",
" .innerText.trim();\n",
" if (!wasOpen) detailsElem.open = false;\n",
" const rows = content.split('\\n').map(row => ` \"${row}\"`);\n",
" const formattedText = `[\\n${rows.join(',\\n')},\\n]`;\n",
" const originalHTML = element.innerHTML.replace('вњ”', '');\n",
" const originalStyle = element.style;\n",
" const copyMark = document.createElement('span');\n",
" copyMark.innerHTML = 'вњ”';\n",
" copyMark.style.color = 'blue';\n",
" copyMark.style.fontSize = '1em';\n",
"\n",
" navigator.clipboard.writeText(formattedText)\n",
" .then(() => {\n",
" element.style.display = 'none';\n",
" element.parentElement.appendChild(copyMark);\n",
"\n",
" setTimeout(() => {\n",
" copyMark.remove();\n",
" element.innerHTML = originalHTML;\n",
" element.style = originalStyle;\n",
" }, 1000);\n",
" })\n",
" .catch(err => {\n",
" console.error('Failed to copy:', err);\n",
" element.style.color = 'orange';\n",
" element.innerHTML = \"Failed!\";\n",
" setTimeout(() => {\n",
" element.innerHTML = originalHTML;\n",
" element.style = originalStyle;\n",
" }, 1000);\n",
" });\n",
" return false;\n",
"}\n",
"/**\n",
" * Adapted from Skrub\n",
" * https://github.com/skrub-data/skrub/blob/403466d1d5d4dc76a7ef569b3f8228db59a31dc3/skrub/_reporting/_data/templates/report.js#L789\n",
" * @returns \"light\" or \"dark\"\n",
" */\n",
"function detectTheme(element) {\n",
" const body = document.querySelector('body');\n",
"\n",
" // Check VSCode theme\n",
" const themeKindAttr = body.getAttribute('data-vscode-theme-kind');\n",
" const themeNameAttr = body.getAttribute('data-vscode-theme-name');\n",
"\n",
" if (themeKindAttr && themeNameAttr) {\n",
" const themeKind = themeKindAttr.toLowerCase();\n",
" const themeName = themeNameAttr.toLowerCase();\n",
"\n",
" if (themeKind.includes(\"dark\") || themeName.includes(\"dark\")) {\n",
" return \"dark\";\n",
" }\n",
" if (themeKind.includes(\"light\") || themeName.includes(\"light\")) {\n",
" return \"light\";\n",
" }\n",
" }\n",
"\n",
" // Check Jupyter theme\n",
" if (body.getAttribute('data-jp-theme-light') === 'false') {\n",
" return 'dark';\n",
" } else if (body.getAttribute('data-jp-theme-light') === 'true') {\n",
" return 'light';\n",
" }\n",
"\n",
" // Guess based on a parent element's color\n",
" const color = window.getComputedStyle(element.parentNode, null).getPropertyValue('color');\n",
" const match = color.match(/^rgb\\s*\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\)\\s*$/i);\n",
" if (match) {\n",
" const [r, g, b] = [\n",
" parseFloat(match[1]),\n",
" parseFloat(match[2]),\n",
" parseFloat(match[3])\n",
" ];\n",
"\n",
" // https://en.wikipedia.org/wiki/HSL_and_HSV#Lightness\n",
" const luma = 0.299 * r + 0.587 * g + 0.114 * b;\n",
"\n",
" if (luma > 180) {\n",
" // If the text is very bright we have a dark theme\n",
" return 'dark';\n",
" }\n",
" if (luma < 75) {\n",
" // If the text is very dark we have a light theme\n",
" return 'light';\n",
" }\n",
" // Otherwise fall back to the next heuristic.\n",
" }\n",
"\n",
" // Fallback to system preference\n",
" return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';\n",
"}\n",
"\n",
"\n",
"function forceTheme(elementId) {\n",
" const estimatorElement = document.querySelector(`#${elementId}`);\n",
" if (estimatorElement === null) {\n",
" console.error(`Element with id ${elementId} not found.`);\n",
" } else {\n",
" const theme = detectTheme(estimatorElement);\n",
" estimatorElement.classList.add(theme);\n",
" }\n",
"}\n",
"\n",
"forceTheme('sk-container-id-1');</script></body>"
],
"text/plain": [
"Pipeline(steps=[('preprocessor',\n",
" ColumnTransformer(transformers=[('num',\n",
" Pipeline(steps=[('imputer',\n",
" SimpleImputer(strategy='median')),\n",
" ('scaler',\n",
" StandardScaler())]),\n",
" Index(['male', 'isMarried', 'isNoble', 'age', 'numDeadRelations',\n",
" 'popularity'],\n",
" dtype='str')),\n",
" ('cat',\n",
" Pipeline(steps=[('imputer',\n",
" SimpleImputer(strategy='most_frequent')),\n",
" ('onehot',\n",
" OneHotEncoder(handle_unknown='ignore'))]),\n",
" Index(['title', 'culture', 'house'], dtype='str'))])),\n",
" ('model',\n",
" LogisticRegression(class_weight='balanced', max_iter=1000))])"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"logreg.fit(X_train, y_train)"
]
},
{
"cell_type": "code",
"execution_count": 30,
"id": "f939feca",
"metadata": {},
"outputs": [],
"source": [
"logreg_pred = logreg.predict(X_test)\n",
"\n",
"logreg_prob = logreg.predict_proba(X_test)[:, 1]"
]
},
{
"cell_type": "code",
"execution_count": 31,
"id": "04bf6c8a",
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAq4AAAHWCAYAAAC2Zgs3AAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjgsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvwVt1zgAAAAlwSFlzAAAPYQAAD2EBqD+naQAAUIVJREFUeJzt3QncTPX7//HrtpN9V/bILksltFpSSVnatFjaS7Kk4lsSJVIhRXukTSWUFOFrqVBCRSEkS4UWa7Kf/+P9+f7P/GbuzT23e5lz36/n4zHcc2bmnM+cc2bmOte5Pp8T53meZwAAAECMy5HZDQAAAABSgsAVAAAAgUDgCgAAgEAgcAUAAEAgELgCAAAgEAhcAQAAEAgErgAAAAgEAlcAAAAEAoErAAAAAoHAFQAABM4XX3xh8+fPD93X319++WWmtgnpj8AVMWnChAkWFxcXuuXLl89OO+00u/vuu2379u2Z3TwAQCbbsmWL3XXXXbZy5Up309+ahqwtV2Y3AEjOkCFDrEqVKnbgwAF3dP3888/bJ598YqtWrbICBQqw8gAgm+rYsaONHj3a6tev7+43bdrUTUPWRuCKmHbJJZfYGWec4f6+5ZZbrESJEjZy5Ej78MMPrXPnzpndPABAJsmbN68tWrTIJTKkbt26ljNnTrZHFkepAAKlRYsW7v+NGze6///++2/r16+f1atXzwoWLGiFCxd2we53332X4LXK2j7yyCOu5EClB+XKlXNH5xs2bHCP//LLLxHlCfFvF1xwQUQtlaa9++679p///MfKli1rJ510kl1++eWJnqr66quv7OKLL7YiRYq4TPH555+fZC2WlpPY8tX2+N58801r3Lix5c+f34oXL27XXnttostP7r2FO3bsmMtg1KlTx62jMmXK2O233247d+6MeF7lypXtsssuS7AclXLEn2dibX/yyScTrFM5ePCgDRo0yKpVq+Z+lCpUqGD333+/m348Sa03/6Z1EL/9n332mTVo0MC919q1a9uUKVMSzHfXrl3Wu3dv1xa1SW174okn3Lo6XomLf9Py4luzZo1dffXVVqpUKbf9atSoYQ8++GDoca2z+Oty3rx5rg133HFHaNqmTZvcKVK9XvPRwd1VV10V8X5F7+2ss85y+4meV7NmTfc+PM+Lel7++/zmm28ipv/5558Jtrf/PvRYOL1W0zUvX7du3dznODnh8//333/d+9BNf/v0vaDPd7Nmzezo0aNJziv+9tJnU98lr7zySqLb68orr3TrT/uLDqg/+uijROe3cOFC97nR+tN3UpcuXRJ8hmTcuHHus6ZtevLJJ1uPHj3c/hafzjQpKFP7wts7efLkFO374fuR/tbnND59HuLvp//884/de++9oX1f+8VTTz0Vsc+Efxdp/1IbixUrZuedd577fInmm1zbwpcbzXeQ9hcFqqeffrq7aR9P6vOGrIOMKwLFDzL1gyA///yzTZs2zf24qqRA9a8vvviiCwx//PFH92Mg+vHSF/PcuXNdcNerVy/bu3evzZ492x2tn3rqqaFlKJN76aWXRix3wIABibZn6NCh7ovygQcesB07drgv3FatWtm3337rfvjlv//9rwumFWAqKMuRI4eNHz/eBeGff/65+7KPr3z58jZs2DD39759++zOO+9MdNkDBw50wY+y0X/88Yc9++yz7gdjxYoVVrRo0QSvue222+zcc891f+tLfurUqRGP6wdCP77du3e3e+65xx0gPPfcc25+CrRz585tJ0o/zP57C6cfLAX+KglRO2vVquXq1kaNGmU//fST287HE77efCoteeeddxI8d926dXbNNde4ILBr165um2g/mjlzprVu3do9Z//+/W5f+vXXX926qVixosvwaH/4/fff3fZOrsRFnn766QQ/ut9//73bDlqfeq/6odW+PX36dLddE6ODsfbt27t9c+zYsaHpS5cudW3Sfq33ryBTgY6CGX0G/JKaPXv2WJMmTdx71XL1Pvv372+5cuVywUk084oV+oy9/vrr1rx5cxf062yMKADcvXu325dTkoHTPlayZEm3jl577TW79dZb3TbRZ1l++OEHt4xTTjnFrTMdpL733ntue3zwwQfWoUOHiPkpMNTnTwH22rVr3TrUQYF/wCt6bPDgwW4Z+nz7z9M2CP+s6eBYBxPaBj179nTLXr16tT3++OOh5em96ztAdIDQp0+fiM96aig41edRB0s333yzO8CbNWuW3Xfffe7zoHXm0/vQ+9GBgvb9PHnyuIN1ffdddNFF7nOi7zHx264Dfn3GJfxgJbXfQUeOHIk48EMW5gExaPz48Tqk9+bMmeP98ccf3pYtW7xJkyZ5JUqU8PLnz+9t3brVPe/AgQPe0aNHI167ceNGL2/evN6QIUNC01577TU3v5EjRyZY1rFjx0Kv03OefPLJBM+pU6eOd/7554fuz5s3zz33lFNO8fbs2ROa/t5777npzzzzTGje1atX99q0aRNajuzfv9+rUqWK17p16wTLatasmVe3bt3Qfb1/zXPQoEGhab/88ouXM2dOb+jQoRGvXblypZcrV64E09etW+fm8frrr4emaX7hXwGff/65u//WW29FvHbmzJkJpleqVMlr27Ztgrb36NEjYp4Sv+3333+/V7p0aa9x48YR6/SNN97wcuTI4doR7oUXXnDz+PLLL73kaF7aTvF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q9dqPmlJQWL8L2r90Ps1gfpRE/2gJkU/4AqMfPqijj/f+DRf/Xgk9bz4p9P8urnk6gc1T7WldOnSiT6uUohwql/TQUU0VCqhgFGnA/36vPDl6zRiUvOMv/wTpe0U/4dV+5po++kgQG3Saf2Utsmv49SPb1IUHIlqFlNCJS46jaztklhtoWo7VR6hUgcFUOHPiR8cKmDx34veu07X6tRvauYl/qn0lNDnLyV0UBe+vnXQqmBJ5T1J0alpneI/88wzXYCn9kcTNDVq1Cj
"text/plain": [
"<Figure size 800x500 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import matplotlib.pyplot as plt\n",
"\n",
"plt.figure(figsize=(8, 5))\n",
"\n",
"plt.hist(\n",
" logreg_prob[y_test.values == 0],\n",
" bins=20,\n",
" alpha=0.6,\n",
" label=\"Живы\"\n",
")\n",
"\n",
"plt.hist(\n",
" logreg_prob[y_test.values == 1],\n",
" bins=20,\n",
" alpha=0.6,\n",
" label=\"Мертвы\"\n",
")\n",
"\n",
"plt.xlabel(\"Предсказанная вероятность смерти\")\n",
"plt.ylabel(\"Количество персонажей\")\n",
"plt.title(\"Распределение предсказанных вероятностей\")\n",
"plt.legend()\n",
"\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 32,
"id": "ad2fe0a4",
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAh8AAAHHCAYAAAAf2DoOAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjgsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvwVt1zgAAAAlwSFlzAAAPYQAAD2EBqD+naQAATzBJREFUeJzt3QucTPX7wPFn3Na6rPta93tKrqkkxepC8ROl+lUUERGSkFQiCqFISf270IV0cStJuUVC5Zr7Pda9EpvVLrtz/q/n6zfTzN7Mmtk5Zufz7nXamXPOnDkzc8w85/k+3+9xWJZlCQAAQJDkCtYTAQAAEHwAAICgI/MB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0cRogaROHNqFqE4zWynj+O/nvf/9rmkq06Ub/TWnzrTYJZRaI+HoceKpYsaLXfa1fcZ0QIeeh5iOH0kxHt27d5OjRo+ZM0nX2kprWb2g7tLYDv/nmmyY7oWf62stCg5dg0HZnPevXYj/XF7E/9Gxv5cqV5gdJizU1m6BflFpf4OuZW7DoD4EW6WlhYHq9OTKrj0mPL2fpauPGjea4uPnmm837pD01AlHvESx6vGoxp56Nf/fdd+bHU2sntAZGfySDTYs0NeB39TjTH3LNJjVv3lzuuusuM1+PPQ2UXn311XS3ocWnFyv1caLPpceC1nul1wPFM8P2yiuvmAyF673ULJ/WXWh9lL4u3fby5ctNtkSDK83MaH2QZmx0/UD1cMloO64aFuQsBB8
"text/plain": [
"<Figure size 640x480 with 2 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from sklearn.metrics import ConfusionMatrixDisplay\n",
"\n",
"ConfusionMatrixDisplay.from_predictions(\n",
" y_test,\n",
" logreg_pred,\n",
" display_labels=[\"Жив\", \"Мёртв\"]\n",
")\n",
"\n",
"plt.title(\"Матрица ошибок Logistic Regression\")\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"id": "49f3bc2e",
"metadata": {},
"source": [
"# Dummy baseline\n",
"\n",
"Сначала построим простую базовую модель, с которой будем сравнивать обученные алгоритмы. "
]
},
{
"cell_type": "code",
"execution_count": 33,
"id": "f5e66dcd",
"metadata": {},
"outputs": [],
"source": [
"from sklearn.dummy import DummyClassifier\n",
"\n",
"dummy = DummyClassifier(strategy='prior')\n",
"dummy.fit(X_train, y_train)\n",
"\n",
"dummy_pred = dummy.predict(X_test)\n",
"dummy_prob = dummy.predict_proba(X_test)[:, 1]"
]
},
{
"cell_type": "markdown",
"id": "7cd11b6a",
"metadata": {},
"source": [
"# Random Forest\n",
"\n",
"Используем 300 деревьев и балансировку классов, а предобработку оставим той же, чтобы корректно работать с пропусками и категориями."
]
},
{
"cell_type": "code",
"execution_count": 34,
"id": "728667ef",
"metadata": {},
"outputs": [],
"source": [
"from sklearn.ensemble import RandomForestClassifier\n",
"\n",
"rf = Pipeline([\n",
" ('preprocessor', preprocessor),\n",
" ('model', RandomForestClassifier(n_estimators=300, random_state=42, class_weight='balanced'))\n",
"])\n",
"\n",
"rf.fit(X_train, y_train)\n",
"\n",
"rf_pred = rf.predict(X_test)\n",
"rf_prob = rf.predict_proba(X_test)[:, 1]"
]
},
{
"cell_type": "markdown",
"id": "051934c6",
"metadata": {},
"source": [
"# Сравнение моделей\n",
"\n",
"Создадим общую функцию расчёта метрик, чтобы оценивать все модели одинаково. "
]
},
{
"cell_type": "code",
"execution_count": 35,
"id": "2ba36a02",
"metadata": {},
"outputs": [],
"source": [
"from sklearn.metrics import (\n",
" accuracy_score,\n",
" precision_score,\n",
" recall_score,\n",
" f1_score,\n",
" roc_auc_score\n",
")\n",
"\n",
"def calculate_metrics(y_true, y_pred, y_prob):\n",
" accuracy = accuracy_score(y_true, y_pred)\n",
" precision = precision_score(y_true, y_pred)\n",
" recall = recall_score(y_true, y_pred)\n",
" f1 = f1_score(y_true, y_pred)\n",
" roc_auc = roc_auc_score(y_true, y_prob)\n",
"\n",
" return {\n",
" \"accuracy\": accuracy,\n",
" \"precision\": precision,\n",
" \"recall\": recall,\n",
" \"f1\": f1,\n",
" \"roc_auc\": roc_auc\n",
" }"
]
},
{
"cell_type": "code",
"execution_count": 36,
"id": "b3effb72",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"c:\\Users\\Masha\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\sklearn\\metrics\\_classification.py:1879: UndefinedMetricWarning: Precision is ill-defined and being set to 0.0 due to no predicted samples. Use `zero_division` parameter to control this behavior.\n",
" _warn_prf(average, modifier, f\"{metric.capitalize()} is\", result.shape[0])\n"
]
}
],
"source": [
"dummy_metrics = calculate_metrics(y_test, dummy_pred, dummy_prob)\n",
"logreg_metrics = calculate_metrics(y_test, logreg_pred, logreg_prob)\n",
"rf_metrics = calculate_metrics(y_test, rf_pred, rf_prob)"
]
},
{
"cell_type": "code",
"execution_count": 38,
"id": "e0278d44",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>accuracy</th>\n",
" <th>precision</th>\n",
" <th>recall</th>\n",
" <th>f1</th>\n",
" <th>roc_auc</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Dummy</th>\n",
" <td>0.745</td>\n",
" <td>0.000</td>\n",
" <td>0.000</td>\n",
" <td>0.000</td>\n",
" <td>0.500</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Logistic Regression</th>\n",
" <td>0.682</td>\n",
" <td>0.410</td>\n",
" <td>0.573</td>\n",
" <td>0.478</td>\n",
" <td>0.706</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Random Forest</th>\n",
" <td>0.717</td>\n",
" <td>0.452</td>\n",
" <td>0.532</td>\n",
" <td>0.489</td>\n",
" <td>0.739</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" accuracy precision recall f1 roc_auc\n",
"Dummy 0.745 0.000 0.000 0.000 0.500\n",
"Logistic Regression 0.682 0.410 0.573 0.478 0.706\n",
"Random Forest 0.717 0.452 0.532 0.489 0.739"
]
},
"execution_count": 38,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"results_table = pd.DataFrame([dummy_metrics, logreg_metrics, rf_metrics], index=['Dummy', 'Logistic Regression', 'Random Forest'])\n",
"\n",
"results_table.round(3)"
]
},
{
"cell_type": "markdown",
"id": "ea217d90",
"metadata": {},
"source": [
"Dummy показывает высокую accuracy (0.745), потому что всегда выбирает преобладающий класс «жив», но не находит ни одной смерти: recall и F1 равны нулю, ROC AUC — 0.5. Случайный лес даёт лучший ROC AUC (0.739) и F1 (0.489), а логистическая регрессия немного лучше находит умерших по recall (0.573 против 0.532). В целом случайный лес выглядит сильнее."
]
},
{
"cell_type": "markdown",
"id": "3cb45f12",
"metadata": {},
"source": [
"Матрица ошибок покажет, на каких классах случайный лес ошибается чаще и какие ошибки скрываются за общими значениями метрик."
]
},
{
"cell_type": "code",
"execution_count": 39,
"id": "bb67ca77",
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAh8AAAHHCAYAAAAf2DoOAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjgsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvwVt1zgAAAAlwSFlzAAAPYQAAD2EBqD+naQAAUJpJREFUeJzt3Qd4FOXWwPGzCSSEEjqE3qVIFRURpVgochGUi1dFBUEQBAQEBKSDAh+oYEGwUK8gNhBFLkpHBJEiKlU6QYpeaQImJNn5nvNyd91NY8NudrPZ/89nzO7M7OxsYefMec/7js2yLEsAAAD8JMxfTwQAAEDwAQAA/I7MBwAA8CuCDwAA4FcEHwAAwK8IPgAAgF8RfAAAAL8i+AAAAH6Vw79PByAruHLlipw5c0bsdruULFky0LsDIMSQ+QBCxNatW+XRRx+VIkWKSGRkpJQoUULat28f6N3KMpo2bWomAJmP4ANOc+bMEZvNZqYNGzakeGd0JP4yZcqY5f/4xz9454LIkiVL5I477pDdu3fLSy+9JCtWrDDT22+/7fd9GT16tPN7plPOnDmlfPny8uyzz8q5c+f8vj9ZVfL3yXWaMWOGZDWXL182+7x27dpA7wqCAM0uSCFXrlyyYMECc7BytW7dOjl+/Lg5a0bw0OaVp556Slq0aCEff/yxRERESFYwffp0yZs3r1y6dElWrVolb7zxhmzfvj3VwDeUOd4nVw0aNJCsGHyMGTPG3CaDhGsh+EAK9913nzlIvf7665Ijx99fEQ1I6tevL//9739514LI7NmzJS4uzmS2skrgof75z3+aJiD19NNPy8MPPywffvihfP/993LrrbcGevey5PvkSxr05cmTx+fbBTxBswtSeOSRR+SPP/4waXnXAsVPPvnE1Ayk5uWXX5bbb79dChcuLFFRUSZI0fVdpZVCdkyOsyVN2+p9PRC98MILEhMTY34k77//fomNjb1mO/2WLVuc20z+/L17906x79qEpGl/Vz/99JN07txZKlasaDJBug9dunQx74snfvvtN+natasUL17cPL5OnToyd+5ct3WOHDli9knfO1c1a9ZM8ZqGDx9u1r148aLb69E0t6vJkye7vZfqu+++k7p168r48eNNs5lmrqpUqSITJ040BaeuEhMTZdy4cVKpUiWznr4v+hnEx8e7rafz9f1x1b17d/Narzftfuedd5q/Bw8edMvaDBw4UGrVqmXO/qOjo6VVq1by448/uj3W8Z356KOPTLNS6dKlzb7cfffdcuDAgRTP9c4775jXqN9VDXS++eYbn3yO06ZNM9+Z3LlzS/Pmzc33VZsr9T3VfdLna9u2rXldvqInCvrvTbetQcpjjz0mv/76q9s6+lnp+6fvrZ5c5MuXTzp27GiW6Xdg6tSpcuONN5rXqK9Vg8GzZ8+mqBnS7Jk+hz5XhQoVzL8Jx3tQtGhRc1uzH45/f8m/n4ADmQ+koAeWhg0bygcffGB+6NV//vMfOX/+vDk71YxIcq+99poJDvQHTQOVhQsXSocOHWTp0qXSunVrs86///1v5/r6Y68HgClTpjjP6vRHz5UeRPQHbPDgweYgoD+Q99xzj+zYscP8+KVF1/eWBl6HDh2SJ5980gQeu3btMvurf/VgnjywcfXXX3+Zg78e9DTY0R9pPUDoAUBrGvr27SuZQbc9YcKEFPM1YNKmDJ30YKEHKm3mGDp0qDlouNYPaPOMHlz1bHvAgAGyefNms809e/bI4sWL03zuUaNGycyZM03AeL0pd90XVbBgQec8/Qw+++wz813S9/H06dOmTqVJkyamfiV5Tx0NqMLCwkzAot/XSZMmme+kvg4H3U89uGqw3K9fP/Mc+t0tV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": [
"<Figure size 640x480 with 2 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from sklearn.metrics import ConfusionMatrixDisplay\n",
"\n",
"\n",
"ConfusionMatrixDisplay.from_predictions(\n",
" y_test,\n",
" rf_pred,\n",
" display_labels=[\"Жив\", \"Мёртв\"]\n",
")\n",
"\n",
"plt.title(\"Матрица ошибок Random Forest\")\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"id": "905fc6a1",
"metadata": {},
"source": [
"Далее сравним модели по ROC-кривым."
]
},
{
"cell_type": "code",
"execution_count": 41,
"id": "4feceec3",
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAc8AAAHWCAYAAAARoQJ4AAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjgsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvwVt1zgAAAAlwSFlzAAAPYQAAD2EBqD+naQAAd+RJREFUeJztnQd4FFUXhk96IUAgECD03ps06UpVUEBQURAQFVFAFCygNFFEFKUoiAWlqAiI4I+CSEeadJDeO6GXkN7mf767mc1msym72U3Z/d7n2ezO7OzMnbub+eace+45bpqmaUIIIYSQTOOe+U0JIYQQQvEkhBBCbICWJyGEEGIlFE9CCCHESiiehBBCiJVQPAkhhBAroXgSQgghVkLxJIQQQqyE4kkIIYRYCcWTEEIIsRKKJyFWMHfuXHFzczM+PD09pWTJkvL888/L5cuXU22P7Jc//vijtGrVSgIDA8Xf319q164tH3zwgURERKR5nGXLlsmjjz4qRYoUEW9vbwkJCZGnn35a1q9fz++LkFyAG3PbEmKdePbv31+JX/ny5SU6Olr+/fdftb5cuXJy6NAh8fX1VdsmJCRIr169ZPHixdKyZUvp3r27Es/NmzfLggULpEaNGrJ27VopVqxYCrF94YUX1P7q168vTz75pBQvXlxCQ0OVoO7Zs0e2bt0qzZo149dGSE4C8SSEZI45c+agkIK2a9euFOtHjBih1i9atMi4buLEiWrdW2+9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ibmfue3jo1VSA7mb5CUs21z
"text/plain": [
"<Figure size 800x500 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from sklearn.metrics import RocCurveDisplay\n",
"\n",
"fig, ax = plt.subplots(figsize=(8, 5))\n",
"\n",
"RocCurveDisplay.from_predictions(\n",
" y_test,\n",
" logreg_prob,\n",
" name=\"Logistic Regression\",\n",
" ax=ax\n",
")\n",
"\n",
"RocCurveDisplay.from_predictions(\n",
" y_test,\n",
" rf_prob,\n",
" name=\"Random Forest\",\n",
" ax=ax\n",
")\n",
"\n",
"plt.title(\"ROC-кривая\")\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"id": "d6fa1c37",
"metadata": {},
"source": [
"ROC-кривая подтверждает небольшое преимущество случайного леса: его AUC выше, поэтому он в среднем лучше ранжирует персонажей по риску смерти. Теперь посмотрим, насколько сильно перекрываются вероятности для реально живых и умерших персонажей."
]
},
{
"cell_type": "code",
"execution_count": 42,
"id": "5785b642",
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAq4AAAHWCAYAAAC2Zgs3AAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjgsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvwVt1zgAAAAlwSFlzAAAPYQAAD2EBqD+naQAAVn9JREFUeJzt3QncTPX///+X7UK47Gv2lF1C1laJJCXaFUppQZZWlURE2qQsLSJtSqGk+KDQgmQpClFCCS3WZJ//7fn+/c98Z67NNZfrumbOdT3ut9twzZkz57znnDMzr3md1/t9cgQCgYABAAAAMS5ntBsAAAAApAaBKwAAAHyBwBUAAAC+QOAKAAAAXyBwBQAAgC8QuAIAAMAXCFwBAADgCwSuAAAA8AUCVwAAAPgCgSsAAPCdL7/80hYsWBC8r7+/+uqrqLYJGY/AFTFp0qRJliNHjuAtX758dsYZZ1ivXr1sx44d0W4eACDKtm7danfddZetXr3a3fS3piFryx3tBgApG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uXLl7fhw4e7v/fv32933nlnkuseOHCgC36Ujf7zzz/thRdecF8YK1eutCJFiiR6To8ePezcc891f+tDfvr06WGP6wtCX74333yz3X333e4HwosvvuiWp0A7T548drL0xey9tlD6wlLgr5IQtbNmzZqubu25556zn376ye3nEwndbh6VlrzzzjuJ5t2wYYNde+21Lgjs2rWr2yc6jmbPnm0XX3yxm+fAgQPuWPr999/dtqlYsaLL8Oh4+OOPP9z+TqnERZ555plEX7rff/+92w/annqt+qLVsT1z5ky3X5OiH2MdOnRwx+aYMWOC05ctW+bapONar19BpgIdBTN6D3glNXv37rUmTZq416r16nU++OCDljt3bhecRLKsWKH32Ouvv24tWrRwQb/OxogCwD179rhjOTUZOB1jJUqUcNvotddes9tuu83tE72X5YcffnDrOPXUU90204/U9957z+2PDz74wK688sqw5Skw1PtPAfb69evdNtSPAu8Hr+ixwYMHu3Xo/e3Np30Q+l7Tj2P9mNA+6N27t1v32rVr7YknngiuT69dnwGiHwj9+vULe6+nhYJTvR/1Y6l79+7uB96cOXPsvvvuc+8HbTOPXodej34o6NiPi4tzP9b12de6dWv3PtHnmHht1w9+vccl9MdKWj+Djh49GvbDD1lYAIhBEydO1E/6wLx58wJ//vlnYOvWrYEpU6YEihcvHsifP3/gt99+c/MdPHgwcOzYsbDnbtq0KZA3b97AkCFDgtNee+01t7xnn3020bqOHz8efJ7meeqppxLNU7t27cD5558fvP/555+7eU899dTA3r17g9Pfe+89N/35558PLvv0008PtGnTJrgeOXDgQKBKlSqBiy++ONG6mjdvHqhTp07wvl6/ljlo0KDgtF9//TWQK1euwLBhw8Keu3r16kDu3LkTTd+wYYNbxuuvvx6cpuWFfgR88cUX7v5bb70V9tzZs2cnml6pUqVAu3btErW9Z8+eYcuUhG2///77A6VKlQo0bNgwbJu+8cYbgZw5c7p2hBo/frxbxldffRVIiZal/ZSQ9qeer/0b2n5N++CDD4LT9uzZEyhbtmzgrLPOCk57/PHHAwUKFAj89NNPYct88MEH3fbfsmVL2PSXX37ZLffbb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il+jX9qIiESiUUMOp0oFefF7p+nUZMbpkJ13+ytJ8SfrHqWBPtP/0IUJt0Wj+1bfLqOPXlmxwFR6KaxdRQiYtOI2u/JFVbqNpOlUeo1EEBVOg8CYNDBSzea9Fr1+lanfpNy7LEO5WeGnr/pYZ+1IVub/1oVbCk8p7k6NS0TvGfffbZLsB
"text/plain": [
"<Figure size 800x500 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.figure(figsize=(8, 5))\n",
"\n",
"plt.hist(\n",
" rf_prob[y_test.values == 0],\n",
" bins=20,\n",
" alpha=0.6,\n",
" label=\"Живы\"\n",
")\n",
"\n",
"plt.hist(\n",
" rf_prob[y_test.values == 1],\n",
" bins=20,\n",
" alpha=0.6,\n",
" label=\"Мертвы\"\n",
")\n",
"\n",
"plt.xlabel(\"Предсказанная вероятность смерти\")\n",
"plt.ylabel(\"Количество персонажей\")\n",
"plt.title(\"Распределение предсказанных вероятностей\")\n",
"plt.legend()\n",
"\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"id": "420ab5e8",
"metadata": {},
"source": [
"У умерших персонажей вероятности в среднем выше, но распределения заметно пересекаются. Это объясняет одновременно умеренный ROC AUC и наличие как пропущенных смертей, так и ложных тревог. Свяжем прогнозы с именами, чтобы посмотреть на конкретные примеры."
]
},
{
"cell_type": "code",
"execution_count": 46,
"id": "7b4089fc",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" name actual_death predicted_death predicted_prob\n",
"684 Lancel V Lannister 0 1 1.000000\n",
"251 Wallen 1 1 1.000000\n",
"281 Aegon II Targaryen 1 1 1.000000\n",
"282 Aegon IV Targaryen 1 1 1.000000\n",
"1077 Hake 1 1 0.998667\n",
"531 Gelmarr 1 1 0.996667\n",
"289 Aenys I Targaryen 1 1 0.994074\n",
"1648 Baelor I Targaryen 1 1 0.993333\n",
"1479 Chett 1 1 0.980000\n",
"1618 Aegon Blackfyre 1 1 0.976667\n",
"831 Ormund Wylde 0 1 0.966667\n",
"1590 Otto Hightower 1 1 0.960000\n",
"25 Willow Witch-eye 1 1 0.949222\n",
"1533 Kurleket 1 1 0.940000\n",
"477 Duncan Targaryen 1 1 0.933333\n",
" name actual_death predicted_death \\\n",
"1138 Jorah Stark 0 0 \n",
"137 S'vrone 0 0 \n",
"1223 Megga Tyrell 0 0 \n",
"1006 Edderion Stark 0 0 \n",
"1218 Mathis Frey 0 0 \n",
"804 Narbo 0 0 \n",
"1343 Ryella Frey 0 0 \n",
"23 Willum 0 0 \n",
"242 Walda Frey (daughter of Edwyn) 0 0 \n",
"816 Ocley 0 0 \n",
"518 Gallard 0 0 \n",
"14 Will (Treb) 0 0 \n",
"855 Poetess 0 0 \n",
"241 Walda Frey (daughter of Lothar) 0 0 \n",
"583 Harodon 0 0 \n",
"\n",
" predicted_prob \n",
"1138 0.003333 \n",
"137 0.003333 \n",
"1223 0.003333 \n",
"1006 0.003333 \n",
"1218 0.000000 \n",
"804 0.000000 \n",
"1343 0.000000 \n",
"23 0.000000 \n",
"242 0.000000 \n",
"816 0.000000 \n",
"518 0.000000 \n",
"14 0.000000 \n",
"855 0.000000 \n",
"241 0.000000 \n",
"583 0.000000 \n"
]
}
],
"source": [
"predictions = df.loc[\n",
" X_test.index,\n",
" [\"name\"]\n",
"].copy()\n",
"\n",
"predictions['actual_death'] = y_test\n",
"predictions['predicted_death'] = rf_pred\n",
"predictions['predicted_prob'] = rf_prob\n",
"\n",
"print(predictions.sort_values('predicted_prob', ascending=False).head(15))\n",
"print(predictions.sort_values('predicted_prob', ascending=False).tail(15))"
]
},
{
"cell_type": "markdown",
"id": "78d3a914",
"metadata": {},
"source": [
"Среди персонажей с максимальным риском большинство действительно умерли, а в нижней части списка находятся живые персонажи. При этом встречаются и уверенные ошибки — например, Ланселю V Ланнистеру модель присвоила вероятность смерти 1.0, хотя фактический класс равен 0. Следующий график компактно показывает персонажей с самым высоким прогнозируемым риском."
]
},
{
"cell_type": "code",
"execution_count": 49,
"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biECAQCduTIEfdvQsS2rZG34dy5c+5i8/LLL3f7r+Pwv//9zw4ePBhl29u2bWsLFiywGjVquGUrV65sH3/8cbSDWzzwwAPuNQozl1xyiXXt2tVdzCbmuI8ZMybKe+iiOPS4nzp1yp588kmrXbu25c2b110wX3311bZo0aKw1/3www/uub59+0bZv+7duwcf//fff1avXj23j9qfxBwvrU/BTfumSccqus8gJl988YU1atTIcufObXny5LG6devaBx98EOtrvGa5ocda1qxZ4+aH9tlav36928YyZcq4fVG1uGfPnrZ///5o1xnq2LFjbvnQZspbtmxxx0Hbq+3OkSOH+yx03nhhNtTatWutdevWbt9UeW7WrJn74iU6+qyjO59D90fL6LyIi14X+fPXNkb+XCZMmOCWjbzt+lx0buk80r62adPGfvrpp7BldFy99ZUtW9auuOIKO3DggGXPnt2tU+d2bPT60P1UP0PtX3RNM+O7PTrGO3bssFatWrllixUrZk899VSUvy///vuvC+MlSpRwv78VK1Z0v4ORl9M5oOV0/mTJkiVse73zL64m7t7vsM4hPZ45c2aU/dN2h/5uivbjlltusfz587vz7Morr7TPPvssymtPnDjhzt8KFSq4c1xVUVXFt2/fHuffdU3e++o802P9HsUmut8V9Yv0/mYWKFDAOnfubLt27bL4iOtvqXfcNP34449hr/3jjz/c35/ojuvmzZvdF4U6ftquOnXq2Jw5c8KW8fZ56dKl7m+ctl2/q3r/0L932rb4/D/HO96hv7Oi5sehxxr+REUOwAWni3VdSGhEPV3YXXrppa5Pj/6Hov+B9uvXL2x5/Q/4uuuuC5s3ePDgZNs+XSDpYkkXXe3bt7exY8e64BAfLVq0cP/DDaXXRw4c+h+0/sfao0cPu//++13V8JVXXnEX2RqYQxdonl9++cU6depkd999t3Xr1s0mTZrkLqbmzZvn3k+0vbqo3LRpkwsFtWrVchcdukjQ4A+qMCb0uMeHAq8uvPUZqTnb0aNH7e2333YXratXr3YXUqLt0YXVTTfdZJdddlmUC3rRBauOnY6Fmgnmy5cvUccrcrXqsccei/f+6D10/BQYdY5pG/QeOta33XabJQV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fP12Yeub+PGjYGMGTMGj5m2PzaRXy9vvvmme+3q1asTtT167X333Rd2Lmm/9Tl458vs2bPdcsOHDw9b58033xzIkCFDYNu2bcF5+t1v1apVvM4/0WcV0757586HH34Y5bmcOXOG/S7179/fLavfR4+OxaWXXhooXbp04OzZs27exIkT3XLPP/98lHVG93sU+TyPbtv1exSb0HXob5L+/pQtWzZw7Nix4DKLFy92ywwcODDWdcXnb6l33Dp37hwoUKBA2N9A/f/itttui3JcmzVrFqhatWrgxIkTYetr0KCBe03kfa5du7b7+xz6t1PzP/nkkyjb5W2P9zchVHS/sx07dgxUqVIlUKJEibDPGP5D00oAF9znn3/uKhGq4nj0rbK+5dU3jKoMpAR9c/zyyy+7yosqR/rGU9+uqiI2fvz4JHsfVcHU9E3VNH3T601qnqhvUSM3S1RTrNBva71mNvpmee/evW6evtHVt8+Rv9UVr8KT0OOub95Dt0+Tvm0PpSZE+vbZa/6oZmyqNKjJkJpTRqZqwh133GEdO3a0n3/+OThf38brG2VVh/St9fkcr9DtV8VD32yXLFnS4qKKgSoH+rY88kilsVXJQmn/Q7fx8OHDUZZRMz+PvrXXcqrWSHTHzPP000+746DPKzqq8KlK4lF1TtUSVYD0uWlSE11VAFR19qjZm855VStUYQ2lprNqWhYXrdvbZ70mKelzUcVY523osdW5pwpiTJ+/V6VURUUV7PjSeey9h5rNaeAmHSOv0pG
"text/plain": [
"<Figure size 900x600 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"top_risk = predictions.sort_values('predicted_prob', ascending=False).head(15).sort_values('predicted_prob', ascending=True)\n",
"\n",
"plt.figure(figsize=(9, 6))\n",
"\n",
"plt.barh(top_risk['name'], top_risk['predicted_prob'])\n",
"plt.title(\"Топ-15 персонажей с наибольшей вероятностью смерти\")\n",
"plt.xlabel(\"Предсказанная вероятность смерти\")\n",
"plt.ylabel(\"Персонажи\")\n",
"\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"id": "b308e75c",
"metadata": {},
"source": [
"Чтобы понять, на какие данные чаще опирается случайный лес, сопоставим признаки после one-hot encoding с рассчитанными моделью значениями важности. "
]
},
{
"cell_type": "code",
"execution_count": 50,
"id": "c61dd7d9",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>feature</th>\n",
" <th>importance</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>num__popularity</td>\n",
" <td>0.235495</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>num__age</td>\n",
" <td>0.078788</td>\n",
" </tr>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>num__male</td>\n",
" <td>0.036648</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>num__numDeadRelations</td>\n",
" <td>0.027229</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>num__isNoble</td>\n",
" <td>0.019680</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>num__isMarried</td>\n",
" <td>0.019098</td>\n",
" </tr>\n",
" <tr>\n",
" <th>557</th>\n",
" <td>cat__house_Night's Watch</td>\n",
" <td>0.019004</td>\n",
" </tr>\n",
" <tr>\n",
" <th>238</th>\n",
" <td>cat__culture_Northmen</td>\n",
" <td>0.015390</td>\n",
" </tr>\n",
" <tr>\n",
" <th>259</th>\n",
" <td>cat__culture_Valyrian</td>\n",
" <td>0.015194</td>\n",
" </tr>\n",
" <tr>\n",
" <th>178</th>\n",
" <td>cat__title_Ser</td>\n",
" <td>0.015119</td>\n",
" </tr>\n",
" <tr>\n",
" <th>365</th>\n",
" <td>cat__house_House Frey</td>\n",
" <td>0.013497</td>\n",
" </tr>\n",
" <tr>\n",
" <th>228</th>\n",
" <td>cat__culture_Ironborn</td>\n",
" <td>0.012538</td>\n",
" </tr>\n",
" <tr>\n",
" <th>503</th>\n",
" <td>cat__house_House Targaryen</td>\n",
" <td>0.011185</td>\n",
" </tr>\n",
" <tr>\n",
" <th>378</th>\n",
" <td>cat__house_House Greyjoy</td>\n",
" <td>0.010847</td>\n",
" </tr>\n",
" <tr>\n",
" <th>491</th>\n",
" <td>cat__house_House Stark</td>\n",
" <td>0.008368</td>\n",
" </tr>\n",
" <tr>\n",
" <th>512</th>\n",
" <td>cat__house_House Tully</td>\n",
" <td>0.007329</td>\n",
" </tr>\n",
" <tr>\n",
" <th>217</th>\n",
" <td>cat__culture_Braavosi</td>\n",
" <td>0.007228</td>\n",
" </tr>\n",
" <tr>\n",
" <th>309</th>\n",
" <td>cat__house_House Bracken</td>\n",
" <td>0.006728</td>\n",
" </tr>\n",
" <tr>\n",
" <th>411</th>\n",
" <td>cat__house_House Lannister</td>\n",
" <td>0.006711</td>\n",
" </tr>\n",
" <tr>\n",
" <th>514</th>\n",
" <td>cat__house_House Tyrell</td>\n",
" <td>0.006562</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" feature importance\n",
"5 num__popularity 0.235495\n",
"3 num__age 0.078788\n",
"0 num__male 0.036648\n",
"4 num__numDeadRelations 0.027229\n",
"2 num__isNoble 0.019680\n",
"1 num__isMarried 0.019098\n",
"557 cat__house_Night's Watch 0.019004\n",
"238 cat__culture_Northmen 0.015390\n",
"259 cat__culture_Valyrian 0.015194\n",
"178 cat__title_Ser 0.015119\n",
"365 cat__house_House Frey 0.013497\n",
"228 cat__culture_Ironborn 0.012538\n",
"503 cat__house_House Targaryen 0.011185\n",
"378 cat__house_House Greyjoy 0.010847\n",
"491 cat__house_House Stark 0.008368\n",
"512 cat__house_House Tully 0.007329\n",
"217 cat__culture_Braavosi 0.007228\n",
"309 cat__house_House Bracken 0.006728\n",
"411 cat__house_House Lannister 0.006711\n",
"514 cat__house_House Tyrell 0.006562"
]
},
"execution_count": 50,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"feature_names = (\n",
" rf\n",
" .named_steps[\"preprocessor\"]\n",
" .get_feature_names_out()\n",
")\n",
"\n",
"feature_importances = (\n",
" rf\n",
" .named_steps[\"model\"]\n",
" .feature_importances_\n",
")\n",
"\n",
"importance_df = pd.DataFrame({\n",
" \"feature\": feature_names,\n",
" \"importance\": feature_importances\n",
"}).sort_values(\n",
" \"importance\",\n",
" ascending=False\n",
")\n",
"\n",
"importance_df.head(20)"
]
},
{
"cell_type": "markdown",
"id": "2fd65c81",
"metadata": {},
"source": [
"Самым важным признаком с большим отрывом стала популярность персонажа, далее идут возраст, пол и количество погибших родственников. Среди категорий выделяются принадлежность к Ночному Дозору и некоторые культуры и дома. Результат согласуется с EDA."
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.2"
}
},
"nbformat": 4,
"nbformat_minor": 5
}