{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "b5503632-1aad-63d7-8bbd-33bf59abc97f"
      },
      "outputs": [],
      "source": [
        "\n",
        "\n",
        "import numpy as np \n",
        "import pandas as pd \n",
        "from subprocess import check_output"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "88a5bcb9-e130-7c7b-3662-8a2039b18c32"
      },
      "outputs": [],
      "source": [
        "# Data files available.\n",
        "\n",
        "print(check_output([\"ls\", \"../input\"]).decode(\"utf8\"))"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "0367ce59-82b0-4304-9c18-af0beffc3d31"
      },
      "outputs": [],
      "source": [
        "# Function to load data\n",
        "\n",
        "def load(filestub):\n",
        "    return pd.read_csv(\"../input/\" + filestub + \".csv\")\n",
        "\n",
        "# clicks_train = pd.read_csv(\"../input/clicks_train.csv\")\n",
        "# clicks_test = pd.read_csv(\"../input/clicks_test.csv\")\n",
        "# documents_categories = pd.read_csv(\"../input/documents_categories.csv\")\n",
        "# documents_entities = pd.read_csv(\"../input/documents_entities.csv\")\n",
        "# documents_meta = pd.read_csv(\"../input/documents_meta.csv\")\n",
        "# documents_topics = pd.read_csv(\"../input/documents_topics.csv\")\n",
        "# events = pd.read_csv(\"../input/events.csv\")\n",
        "# page_views_sample = pd.read_csv(\"../input/page_views_sample.csv\")\n",
        "# promoted_content = pd.read_csv(\"../input/promoted_content.csv\")\n",
        "# sample_submission = pd.read_csv(\"../input/sample_submission.csv\")\n",
        "\n",
        "\n",
        "                         "
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "d2ece716-745d-dcbb-5e8d-11037fd6e0fa"
      },
      "outputs": [],
      "source": [
        "# Get a look at it.\n",
        "\n",
        "# data = [clicks_train, \n",
        "#         clicks_test, \n",
        "#         documents_categories, \n",
        "#         documents_entities, \n",
        "#         documents_meta,\n",
        "#         documents_topics, \n",
        "#         events,\n",
        "#         page_views_sample,\n",
        "#         promoted_content, \n",
        "#         sample_submission]\n",
        "# names_of_data = [\"clicks_train\", \n",
        "#         \"clicks_test\", \n",
        "#         \"documents_categories\", \n",
        "#         \"documents_entities\", \n",
        "#         \"documents_meta\",\n",
        "#         \"documents_topics\", \n",
        "#         \"events\",\n",
        "#         \"page_views_sample\",\n",
        "#         \"promoted_content\", \n",
        "#         \"sample_submission\"]\n",
        "\n",
        "# for d, s in zip(data, names_of_data):\n",
        "#     print (s, d.shape)\n",
        "#     print(d.head())\n",
        "#     print()\n",
        "    \n",
        "    "
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "_cell_guid": "b3f5f875-f0b0-28d2-beea-93fdc8427fca"
      },
      "source": [
        "Summary of available data: \n",
        "\n",
        "Users look at documents which display a set of ads, each belonging to an ad campaign run by an advertiser. We know information about the documents in documents_*, including entities mentioned, category, topic (all with confidence level), publisher, source, time published. We know information about the ads in promoted_content, including the id of the document in which the ad appeared, the campaign the ad belonged to, the advertiser. In page_views, we have a log of which users looked at which documents, when, where, and how they got to the document (internal to the site, via search, via social (sharing i guess)). \n",
        "\n",
        "In events, we characterize what a display is: includes a user, document, timestamp, platform, location (basically page_views with a display id attached and traffic source removed?) \n",
        "\n",
        "The training data consists of a display_id and ad_id and whether or not that ad was clicked. Each display might have several ads, but in the training data only one is clicked on (confirm?). The testing data has display_id and ad_id, and we report results by listing display_id and a list of ad_ids that we predict will be clicked, from the list of ad_ids displayed on display given by display_id. \n",
        "\n",
        "So, initial basic questions: \n",
        "\n",
        "how many ads on a given display? uniform?\n",
        "train data has exactly 1 click per display as I interpreted?\n",
        "What's the point of page_views? Develop user profile I guess? What does this user like to look at and when e.g., even if there's not click data for every page view. \n",
        "How many users we talking? \n",
        "Do some users click on ads a lot? \n",
        "Do some ads get clicked on a lot?\n",
        "Do some campaigns get clicked on a lot?\n",
        "Do some documents have ads getting clicked on a lot?\n",
        "Are users replicated in the training and testing data? "
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "8a59bf59-685e-46c2-b7af-0269d790dc25"
      },
      "outputs": [],
      "source": [
        "#How many unique users in events data? \n",
        "\n",
        "print(events.shape)\n",
        "ids = events['uuid']\n",
        "a = ids.unique()\n",
        "print(a[:5])\n",
        "#How many unique users in page_views_sample?\n",
        "#How many unique users in page_views?"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "5cce549c-c533-afb1-4950-e116bc8b3703"
      },
      "outputs": [],
      "source": ""
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "fb5b25b4-bec2-a5db-b8ea-395a8e29cd12"
      },
      "outputs": [],
      "source": ""
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "ca98e7e4-d335-e928-ffca-041b2d1f53c9"
      },
      "outputs": [],
      "source": ""
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "d74e5bbf-4793-1184-480d-efdc36a98d74"
      },
      "outputs": [],
      "source": ""
    }
  ],
  "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
}