{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Contributions comparing plot\n",
"\n",
"compare_plot is a method that displays scatter plot of contributions of several individuals.
\n",
"The purpose of these representations is to understand where the difference of predictions of several indivuals stems from.
\n",
"\n",
"This tutorial presents the different parameters you can use in compare_plot to tune output.\n",
"\n",
"Contents:\n",
"- Loading dataset and fitting a model.\n",
"\n",
"- Regression case: Specify the target modality to display.\n",
"\n",
"- Input parameters\n",
"\n",
"- Classification case\n",
"\n",
"\n",
"Data from Kaggle: [House Prices](https://www.kaggle.com/c/house-prices-advanced-regression-techniques/data)"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"from catboost import CatBoostRegressor\n",
"from sklearn.model_selection import train_test_split"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Building Supervized Model"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### First Step : Load house prices data"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"from shapash.data.data_loader import data_loading\n",
"house_df, house_dict = data_loading('house_prices')\n",
"y_df = house_df['SalePrice'].to_frame()\n",
"X_df = house_df[house_df.columns.difference(['SalePrice'])]"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
\n", " | 1stFlrSF | \n", "2ndFlrSF | \n", "3SsnPorch | \n", "BedroomAbvGr | \n", "BldgType | \n", "BsmtCond | \n", "BsmtExposure | \n", "BsmtFinSF1 | \n", "BsmtFinSF2 | \n", "BsmtFinType1 | \n", "... | \n", "SaleType | \n", "ScreenPorch | \n", "Street | \n", "TotRmsAbvGrd | \n", "TotalBsmtSF | \n", "Utilities | \n", "WoodDeckSF | \n", "YearBuilt | \n", "YearRemodAdd | \n", "YrSold | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Id | \n", "\n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " |
1 | \n", "856 | \n", "854 | \n", "0 | \n", "3 | \n", "Single-family Detached | \n", "Typical - slight dampness allowed | \n", "No Exposure/No Basement | \n", "706 | \n", "0 | \n", "Good Living Quarters | \n", "... | \n", "Warranty Deed - Conventional | \n", "0 | \n", "Paved | \n", "8 | \n", "856 | \n", "All public Utilities (E,G,W,& S) | \n", "0 | \n", "2003 | \n", "2003 | \n", "2008 | \n", "
2 | \n", "1262 | \n", "0 | \n", "0 | \n", "3 | \n", "Single-family Detached | \n", "Typical - slight dampness allowed | \n", "Good Exposure | \n", "978 | \n", "0 | \n", "Average Living Quarters | \n", "... | \n", "Warranty Deed - Conventional | \n", "0 | \n", "Paved | \n", "6 | \n", "1262 | \n", "All public Utilities (E,G,W,& S) | \n", "298 | \n", "1976 | \n", "1976 | \n", "2007 | \n", "
3 | \n", "920 | \n", "866 | \n", "0 | \n", "3 | \n", "Single-family Detached | \n", "Typical - slight dampness allowed | \n", "Mimimum Exposure | \n", "486 | \n", "0 | \n", "Good Living Quarters | \n", "... | \n", "Warranty Deed - Conventional | \n", "0 | \n", "Paved | \n", "6 | \n", "920 | \n", "All public Utilities (E,G,W,& S) | \n", "0 | \n", "2001 | \n", "2002 | \n", "2008 | \n", "
4 | \n", "961 | \n", "756 | \n", "0 | \n", "3 | \n", "Single-family Detached | \n", "Good | \n", "No Exposure/No Basement | \n", "216 | \n", "0 | \n", "Average Living Quarters | \n", "... | \n", "Warranty Deed - Conventional | \n", "0 | \n", "Paved | \n", "7 | \n", "756 | \n", "All public Utilities (E,G,W,& S) | \n", "0 | \n", "1915 | \n", "1970 | \n", "2006 | \n", "
5 | \n", "1145 | \n", "1053 | \n", "0 | \n", "4 | \n", "Single-family Detached | \n", "Typical - slight dampness allowed | \n", "Average Exposure | \n", "655 | \n", "0 | \n", "Good Living Quarters | \n", "... | \n", "Warranty Deed - Conventional | \n", "0 | \n", "Paved | \n", "9 | \n", "1145 | \n", "All public Utilities (E,G,W,& S) | \n", "192 | \n", "2000 | \n", "2000 | \n", "2008 | \n", "
5 rows × 72 columns
\n", "