{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "f2c63f73-f3ac-62c7-fa0c-ae24624eb4bf"
      },
      "outputs": [],
      "source": [
        "\n",
        "# This Python 3 environment comes with many helpful analytics libraries installed\n",
        "# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python\n",
        "# For example, here's several helpful packages to load in \n",
        "\n",
        "import numpy as np # linear algebra\n",
        "import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n",
        "\n",
        "# Input data files are available in the \"../input/\" directory.\n",
        "# For example, running this (by clicking run or pressing Shift+Enter) will list the files in the input directory\n",
        "\n",
        "from subprocess import check_output\n",
        "print(check_output([\"ls\", \"../input\"]).decode(\"utf8\"))\n",
        "\n",
        "# Any results you write to the current directory are saved as output.\n",
        "import os\n",
        "import gc # We're gonna be clearing memory a lot\n",
        "import matplotlib.pyplot as plt\n",
        "import seaborn as sns\n",
        "%matplotlib inline\n",
        "\n",
        "df_train = pd.read_csv('../input/clicks_train.csv')\n",
        "df_test = pd.read_csv('../input/clicks_test.csv')"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "56fcff3b-5b5a-a5ae-c98d-35f02d9e5b6d"
      },
      "outputs": [],
      "source": [
        "p = sns.color_palette()\n",
        "sizes_train = df_train.groupby('display_id')['ad_id'].count().value_counts()\n",
        "sizes_test = df_test.groupby('display_id')['ad_id'].count().value_counts()\n",
        "sizes_train = sizes_train / np.sum(sizes_train)\n",
        "sizes_test = sizes_test / np.sum(sizes_test)\n",
        "\n",
        "plt.figure(figsize=(12,4))\n",
        "sns.barplot(sizes_train.index, sizes_train.values, alpha=0.8, color=p[0], label='train')\n",
        "sns.barplot(sizes_test.index, sizes_test.values, alpha=0.6, color=p[1], label='test')\n",
        "plt.legend()\n",
        "plt.xlabel('Number of Ads in display', fontsize=12)\n",
        "plt.ylabel('Proportion of set', fontsize=12)"
      ]
    }
  ],
  "metadata": {
    "_change_revision": 0,
    "_is_fork": false,
    "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.5.2"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}