{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "61c88034-1243-4ab7-9d20-96398b0d9efd",
   "metadata": {},
   "source": [
    "# Case Study: Predictive Analytics for E-commerce\n",
    "\n",
    "## Business Context:\n",
    "- You are hired as a Data Science and AI for an e-commerce company named \"Terra Store.\" Terra Store is looking to enhance its marketing strategy by predicting customer purchase behavior based on historical data. The company wants to build an AI-powered application that can provide insights into which products a customer is likely to purchase next.\n",
    "\n",
    "## Problem Statement:\n",
    "- Terra Store has provided you with a dataset containing information about customer interactions, purchases, and product details. Your task is to develop a web-based AI application that predicts the next product a customer is likely to buy. The application should be user-friendly, allowing marketing teams to target customers more effectively."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f4f2378e-150a-4caa-9de0-6d4034bded4b",
   "metadata": {},
   "source": [
    "## Data Description:\n",
    "- The dataset includes the following information:\n",
    "- Customer Interactions:\n",
    "   - Customer ID\n",
    "   - Page views\n",
    "   - Time spent on the website\n",
    "- Purchase History:\n",
    "   - Customer ID\n",
    "   - Product ID\n",
    "   - Purchase date\n",
    "- Product Details:\n",
    "   - Product ID\n",
    "   - Category\n",
    "   - Price\n",
    "   - Ratings"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "270ab428-5a85-4b96-8fc2-0b5b803c625d",
   "metadata": {},
   "source": [
    "## Step by Step\n",
    "1. Data exploration\n",
    "2. Data preprocessing\n",
    "3. Model Development\n",
    "4. Web Application Development"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0730d462-87a6-4b07-af77-ab4e02e77f9f",
   "metadata": {},
   "source": [
    "## Data exploration"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 444,
   "id": "2c8130e6-7add-4d51-8e5a-aeab1a3bec09",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "import random\n",
    "import warnings\n",
    "import joblib\n",
    "import gradio as gr\n",
    "\n",
    "from faker import Faker\n",
    "\n",
    "import matplotlib.pyplot as plt\n",
    "import seaborn as sns\n",
    "\n",
    "from surprise import KNNWithMeans\n",
    "from surprise.model_selection import train_test_split\n",
    "from surprise.accuracy import rmse\n",
    "\n",
    "from surprise import Dataset\n",
    "from surprise import Reader\n",
    "\n",
    "fake = Faker()\n",
    "warnings.filterwarnings('ignore')\n",
    "pd.set_option(\"display.max_columns\", 100)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "b4100a7e-59e3-4fe6-a0ac-b3c3e3c69621",
   "metadata": {},
   "outputs": [],
   "source": [
    "df_ci = pd.read_csv(\"/Users/Ruangguru/Documents/Project/skilvul/customer_interactions.csv\")\n",
    "df_pd = pd.read_csv(\"/Users/Ruangguru/Documents/Project/skilvul/product_details.csv\", delimiter=';')\n",
    "df_ph = pd.read_csv(\"/Users/Ruangguru/Documents/Project/skilvul/purchase_history.csv\", delimiter=';')"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c01b2fbc-683a-4169-8096-d5c2f61564ed",
   "metadata": {},
   "source": [
    "- because the data is very small, so i decided to create syntetics data "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3036a93f-129e-4a08-a446-441e2dcacfbf",
   "metadata": {},
   "source": [
    "### data customer interactions"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "365d1c9c-069a-476e-84e2-a6cd872ecaca",
   "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>customer_id</th>\n",
       "      <th>page_views</th>\n",
       "      <th>time_spent</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>25</td>\n",
       "      <td>120</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>20</td>\n",
       "      <td>90</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>30</td>\n",
       "      <td>150</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>15</td>\n",
       "      <td>80</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>22</td>\n",
       "      <td>110</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   customer_id  page_views  time_spent\n",
       "0            1          25         120\n",
       "1            2          20          90\n",
       "2            3          30         150\n",
       "3            4          15          80\n",
       "4            5          22         110"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_ci"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 169,
   "id": "9d770909-3e13-4e5f-b18b-f6db1438dfb7",
   "metadata": {},
   "outputs": [],
   "source": [
    "len_fake_data_ci = 95\n",
    "df_fake_ci = pd.DataFrame()\n",
    "df_fake_ci = df_fake_ci.assign(page_views = pd.Series(fake.random.randint(1, 35) for i in range(len_fake_data_ci)),\n",
    "                               time_spent = pd.Series(fake.random.randint(50, 300) for i in range(len_fake_data_ci)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 170,
   "id": "d4944ac3-326b-4339-ab4b-e5c0ac555a61",
   "metadata": {},
   "outputs": [],
   "source": [
    "df_fake_ci = df_fake_ci.reset_index().rename(columns={\n",
    "    'index' : 'customer_id'\n",
    "})\n",
    "\n",
    "df_fake_ci['customer_id'] = df_fake_ci['customer_id'] + 6"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 173,
   "id": "4370a491-b716-41ce-9be6-941fc7aa16a3",
   "metadata": {},
   "outputs": [],
   "source": [
    "df_ci_full = pd.concat([df_ci, df_fake_ci], ignore_index=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4b43983c-1c6a-4bc5-8d86-0744fed3fed1",
   "metadata": {},
   "source": [
    "### product details"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "ea1710f6-b1cc-485e-8e71-de9462cd9b13",
   "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>product_id</th>\n",
       "      <th>category</th>\n",
       "      <th>price</th>\n",
       "      <th>ratings</th>\n",
       "      <th>Unnamed: 4</th>\n",
       "      <th>Unnamed: 5</th>\n",
       "      <th>Unnamed: 6</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>101</td>\n",
       "      <td>Electronics</td>\n",
       "      <td>500</td>\n",
       "      <td>4.5</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>102</td>\n",
       "      <td>Clothing</td>\n",
       "      <td>50</td>\n",
       "      <td>3.8</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>103</td>\n",
       "      <td>Home &amp; Kitchen</td>\n",
       "      <td>200</td>\n",
       "      <td>4.2</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>104</td>\n",
       "      <td>Beauty</td>\n",
       "      <td>30</td>\n",
       "      <td>4.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>105</td>\n",
       "      <td>Electronics</td>\n",
       "      <td>800</td>\n",
       "      <td>4.8</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   product_id        category  price  ratings  Unnamed: 4  Unnamed: 5  \\\n",
       "0         101     Electronics    500      4.5         NaN         NaN   \n",
       "1         102        Clothing     50      3.8         NaN         NaN   \n",
       "2         103  Home & Kitchen    200      4.2         NaN         NaN   \n",
       "3         104          Beauty     30      4.0         NaN         NaN   \n",
       "4         105     Electronics    800      4.8         NaN         NaN   \n",
       "\n",
       "   Unnamed: 6  \n",
       "0         NaN  \n",
       "1         NaN  \n",
       "2         NaN  \n",
       "3         NaN  \n",
       "4         NaN  "
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 196,
   "id": "5af8face-680b-443f-91c3-bafe78e322a8",
   "metadata": {},
   "outputs": [],
   "source": [
    "len_fake_data_pd = 20\n",
    "df_fake_pd = pd.DataFrame()\n",
    "df_fake_pd = df_fake_pd.assign(category = pd.Series(random.choice(['Electronics', 'Clothing', 'Home & Kitchen', 'Beauty']) for i in range(len_fake_data_pd)),\n",
    "                               price = pd.Series(fake.random.randint(30, 1000) for i in range(len_fake_data_ci)),\n",
    "                               ratings = pd.Series(round(fake.random.uniform(1, 5), 2) for i in range(len_fake_data_ci)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 197,
   "id": "c2d9c9cf-096f-4eeb-a5b1-30c02d43655b",
   "metadata": {},
   "outputs": [],
   "source": [
    "df_fake_pd = df_fake_pd.reset_index().rename(columns={\n",
    "    'index' : 'product_id'\n",
    "})\n",
    "\n",
    "df_fake_pd['product_id'] = df_fake_pd['product_id'] + 106"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 199,
   "id": "8915489e-fab3-4582-9c4f-2d9e5d5037f8",
   "metadata": {},
   "outputs": [],
   "source": [
    "df_pd_full = pd.concat([df_pd, df_fake_pd], ignore_index=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9d5c54e3-a9fb-46ce-8614-b33093075196",
   "metadata": {},
   "source": [
    "### purchase history"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 246,
   "id": "3e8adc2c-12f4-4de1-a329-e6e6500577ae",
   "metadata": {},
   "outputs": [],
   "source": [
    "len_fake_data_ph = 994\n",
    "df_fake_ph = pd.DataFrame()\n",
    "df_fake_ph = df_fake_ph.assign(customer_id = pd.Series(fake.random.randint(1, 100) for i in range(len_fake_data_ph)),\n",
    "                               product_id = pd.Series(fake.random.randint(101, 125) for i in range(len_fake_data_ph)),\n",
    "                               purchase_date = pd.Series(fake.date_between_dates(pd.to_datetime('2023-01-01'), pd.to_datetime('2023-01-06')) for i in range(len_fake_data_ph)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 247,
   "id": "5e6089c9-16c9-4f72-b722-fb9f96f55af4",
   "metadata": {},
   "outputs": [],
   "source": [
    "df_ph_full = pd.concat([df_ph, df_fake_ph], ignore_index=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "632e3b2b-f489-43f4-8b08-4853745bd259",
   "metadata": {},
   "source": [
    "### final data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 248,
   "id": "fb959b97-8ddf-4b99-a985-65096de6e019",
   "metadata": {},
   "outputs": [],
   "source": [
    "df_ph_full = pd.merge(df_ph_full, df_ci_full, on=['customer_id']).drop(columns=['Unnamed: 3', 'Unnamed: 4', 'Unnamed: 5', 'Unnamed: 6'])\n",
    "df_ph_final = pd.merge(df_ph_full, df_pd_full, on=['product_id']).drop(columns=['Unnamed: 4', 'Unnamed: 5', 'Unnamed: 6'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 249,
   "id": "be4f2ee4-4dfa-4feb-959c-700861e4725d",
   "metadata": {},
   "outputs": [],
   "source": [
    "df_ph_final['purchase_date'] = pd.to_datetime(df_ph_final['purchase_date'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 250,
   "id": "3e2980ea-13c3-45db-a862-2b6b0dd2793e",
   "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>customer_id</th>\n",
       "      <th>product_id</th>\n",
       "      <th>purchase_date</th>\n",
       "      <th>page_views</th>\n",
       "      <th>time_spent</th>\n",
       "      <th>category</th>\n",
       "      <th>price</th>\n",
       "      <th>ratings</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>101</td>\n",
       "      <td>2023-01-01</td>\n",
       "      <td>25</td>\n",
       "      <td>120</td>\n",
       "      <td>Electronics</td>\n",
       "      <td>500</td>\n",
       "      <td>4.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>3</td>\n",
       "      <td>101</td>\n",
       "      <td>2023-01-01</td>\n",
       "      <td>30</td>\n",
       "      <td>150</td>\n",
       "      <td>Electronics</td>\n",
       "      <td>500</td>\n",
       "      <td>4.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>101</td>\n",
       "      <td>2023-01-03</td>\n",
       "      <td>30</td>\n",
       "      <td>150</td>\n",
       "      <td>Electronics</td>\n",
       "      <td>500</td>\n",
       "      <td>4.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>101</td>\n",
       "      <td>2023-01-02</td>\n",
       "      <td>15</td>\n",
       "      <td>80</td>\n",
       "      <td>Electronics</td>\n",
       "      <td>500</td>\n",
       "      <td>4.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>101</td>\n",
       "      <td>2023-01-05</td>\n",
       "      <td>22</td>\n",
       "      <td>110</td>\n",
       "      <td>Electronics</td>\n",
       "      <td>500</td>\n",
       "      <td>4.5</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   customer_id  product_id purchase_date  page_views  time_spent     category  \\\n",
       "0            1         101    2023-01-01          25         120  Electronics   \n",
       "1            3         101    2023-01-01          30         150  Electronics   \n",
       "2            3         101    2023-01-03          30         150  Electronics   \n",
       "3            4         101    2023-01-02          15          80  Electronics   \n",
       "4            5         101    2023-01-05          22         110  Electronics   \n",
       "\n",
       "   price  ratings  \n",
       "0    500      4.5  \n",
       "1    500      4.5  \n",
       "2    500      4.5  \n",
       "3    500      4.5  \n",
       "4    500      4.5  "
      ]
     },
     "execution_count": 250,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_ph_final.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f7a3bd03-0cc0-4436-9c38-83f773955fa8",
   "metadata": {},
   "source": [
    "- the final data that i will used to build the model"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 251,
   "id": "ead8f76e-0c6b-48d1-a1d4-8516da1d0bb4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(1000, 8)"
      ]
     },
     "execution_count": 251,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_ph_final.shape"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9bd56d0f-8cc3-4019-b538-b53b6b595b6a",
   "metadata": {},
   "source": [
    "- total data 1000 with 8 columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 252,
   "id": "57449465-a0e0-4cff-9bd1-ee0f4de35087",
   "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>customer_id</th>\n",
       "      <th>product_id</th>\n",
       "      <th>purchase_date</th>\n",
       "      <th>page_views</th>\n",
       "      <th>time_spent</th>\n",
       "      <th>price</th>\n",
       "      <th>ratings</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>1000.000000</td>\n",
       "      <td>1000.00000</td>\n",
       "      <td>1000</td>\n",
       "      <td>1000.000000</td>\n",
       "      <td>1000.000000</td>\n",
       "      <td>1000.000000</td>\n",
       "      <td>1000.00000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>49.077000</td>\n",
       "      <td>112.73200</td>\n",
       "      <td>2023-01-02 22:45:07.200000</td>\n",
       "      <td>19.996000</td>\n",
       "      <td>163.470000</td>\n",
       "      <td>469.828000</td>\n",
       "      <td>3.03613</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>1.000000</td>\n",
       "      <td>101.00000</td>\n",
       "      <td>2023-01-01 00:00:00</td>\n",
       "      <td>2.000000</td>\n",
       "      <td>50.000000</td>\n",
       "      <td>30.000000</td>\n",
       "      <td>1.06000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>24.000000</td>\n",
       "      <td>106.00000</td>\n",
       "      <td>2023-01-02 00:00:00</td>\n",
       "      <td>11.000000</td>\n",
       "      <td>98.000000</td>\n",
       "      <td>146.000000</td>\n",
       "      <td>1.48000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>49.000000</td>\n",
       "      <td>113.00000</td>\n",
       "      <td>2023-01-03 00:00:00</td>\n",
       "      <td>22.000000</td>\n",
       "      <td>158.000000</td>\n",
       "      <td>480.000000</td>\n",
       "      <td>3.23500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>74.000000</td>\n",
       "      <td>119.00000</td>\n",
       "      <td>2023-01-04 00:00:00</td>\n",
       "      <td>28.000000</td>\n",
       "      <td>226.000000</td>\n",
       "      <td>774.000000</td>\n",
       "      <td>4.20000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>100.000000</td>\n",
       "      <td>125.00000</td>\n",
       "      <td>2023-01-05 00:00:00</td>\n",
       "      <td>35.000000</td>\n",
       "      <td>298.000000</td>\n",
       "      <td>962.000000</td>\n",
       "      <td>4.92000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>29.202463</td>\n",
       "      <td>7.37296</td>\n",
       "      <td>NaN</td>\n",
       "      <td>9.906469</td>\n",
       "      <td>73.424575</td>\n",
       "      <td>296.960088</td>\n",
       "      <td>1.36245</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       customer_id  product_id               purchase_date   page_views  \\\n",
       "count  1000.000000  1000.00000                        1000  1000.000000   \n",
       "mean     49.077000   112.73200  2023-01-02 22:45:07.200000    19.996000   \n",
       "min       1.000000   101.00000         2023-01-01 00:00:00     2.000000   \n",
       "25%      24.000000   106.00000         2023-01-02 00:00:00    11.000000   \n",
       "50%      49.000000   113.00000         2023-01-03 00:00:00    22.000000   \n",
       "75%      74.000000   119.00000         2023-01-04 00:00:00    28.000000   \n",
       "max     100.000000   125.00000         2023-01-05 00:00:00    35.000000   \n",
       "std      29.202463     7.37296                         NaN     9.906469   \n",
       "\n",
       "        time_spent        price     ratings  \n",
       "count  1000.000000  1000.000000  1000.00000  \n",
       "mean    163.470000   469.828000     3.03613  \n",
       "min      50.000000    30.000000     1.06000  \n",
       "25%      98.000000   146.000000     1.48000  \n",
       "50%     158.000000   480.000000     3.23500  \n",
       "75%     226.000000   774.000000     4.20000  \n",
       "max     298.000000   962.000000     4.92000  \n",
       "std      73.424575   296.960088     1.36245  "
      ]
     },
     "execution_count": 252,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_ph_final.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 253,
   "id": "04bb7bda-847d-41db-8b2b-490d62401368",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "customer_id\n",
       "3     21\n",
       "49    17\n",
       "70    16\n",
       "38    15\n",
       "16    15\n",
       "82    15\n",
       "84    14\n",
       "23    14\n",
       "18    14\n",
       "63    14\n",
       "Name: count, dtype: int64"
      ]
     },
     "execution_count": 253,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_ph_final['customer_id'].value_counts().head(10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 254,
   "id": "071c9a8b-dd76-46f7-9ace-4af99b5bdc51",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "product_id\n",
       "103    50\n",
       "105    49\n",
       "102    48\n",
       "121    46\n",
       "101    44\n",
       "118    43\n",
       "108    43\n",
       "117    42\n",
       "115    42\n",
       "107    41\n",
       "Name: count, dtype: int64"
      ]
     },
     "execution_count": 254,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_ph_final['product_id'].value_counts().head(10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 255,
   "id": "7f278206-cc47-4760-bef2-2f510df2ef4b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAApEAAAGwCAYAAADxMz7FAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8WgzjOAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA0UUlEQVR4nO3deViVdf7/8ddB5YCyuSBLobjgLqZmDjm5QYpWPywrMkYxzRa3cdQym3FrbLQpWxxLK2ck22sybWiyzBE01DQVtSQXwtQEl0y2coP794eX59sJVD5H4CA8H9d1X3Huz+e+7/f9uc65zqvPfd9Hm2VZlgAAAAADHu4uAAAAAFcfQiQAAACMESIBAABgjBAJAAAAY4RIAAAAGCNEAgAAwBghEgAAAMZqu7sAVF/FxcU6fPiwfH19ZbPZ3F0OAAAoA8uylJ+fr9DQUHl4XHy+kRCJCnP48GGFhYW5uwwAAOCCgwcP6tprr71oOyESFcbX11fS+Tehn5+fm6sBAABlkZeXp7CwMMf3+MUQIlFhLlzC9vPzI0QCAHCVudytaDxYAwAAAGOESAAAABgjRAIAAMAYIRIAAADGCJEAAAAwRogEAACAMX7iBxWu51/eVi27t7vLAACg0mx5epi7S6hwzEQCAADAGCESAAAAxgiRAAAAMEaIBAAAgDFCJAAAAIwRIgEAAGCMEAkAAABjhEgAAAAYI0QCAADAGCESAAAAx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kuTr63slu0E1RIgEAODqU9bvb5d/J/ICwiMAAEDN41KI7Ny5c6mXrG02m7y8vNSyZUsNHz5cffr0ueICAQAAUPW49BM/sbGx+u6771SvXj316dNHffr0kY+PjzIzM9WtWzdlZ2crJiZGK1asKO96AQAAUAW4NBN5/PhxTZo0SdOmTXNaP3v2bH3//ff67LPPNGPGDP31r39VXFxcuRQKAACAqsOlB2v8/f21ZcsWtWzZ0mn9vn371LVrV+Xm5urbb79Vt27dHA/eoObhwRoAAK4+Zf3+dulytpeXl9avX19i/fr16+Xl5SVJKi4udvwNAACA6sWly9njxo3TQw89pC1btqhbt26SpM2bN2vx4sV6/PHHJUmffvqprrvuunIrFAAAAFWHy78T+eabb2rBggXavXu3JKl169YaN26c7r33XknSL7/84nhaGzUTl7MBALj6VNqPjQMXQ4gEAODqU6H3RErSyZMnHZevT5w4IUnaunWrfvjhB1d3CQAAgKuES/dE7tixQzExMfL399f+/ft1//33q0GDBlq2bJkOHDigpUuXlnedAAAAqEJcmomcOHGihg8frr179zrd8zhw4ECtXbu23IoDAABA1eRSiNy8ebMefPDBEuuvueYa5eTkXHFRAAAAqNpcCpF2u115eXkl1u/Zs0eBgYFXXBQAAACqNpfuifx//+//6YknntB7770nSbLZbDpw4ICmTJmiwYMHl2uBuPr1/MvbqmX3dncZAAAY2/L0MHeXUGW5NBM5b948FRQUqHHjxvrll1/Uq1cvtWzZUr6+vnryySfLu0YAAABUMS7NRPr7+2vVqlVKS0vT9u3bVVBQoC5duigmJqa86wMAAEAV5FKIXLp0qeLj49WjRw/16NHDsf7MmTN65513NGwYU78AAADVmUuXs++77z7l5uaWWJ+fn6/77rvviosCAABA1eZSiLQsSzabrcT6Q4cOyd/f/4qLAgAAQNVmdDm7c+fOstlsstlsio6OVu3a/7d5UVGRsrKyFBsbW+5FAgAAoGoxCpGDBg2SJKWnp6t///7y8fFxtHl6eio8PJyf+AEAAKgBjELkjBkzJEnh4eGKj493+icPAQAAUHO49HR2YmJiedcBAACAq4hLIb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K52cyP/zwQ61bt+6S/S4mPT1d1157rSNAlqZu3bqOAClJISEhjvMuLCxUZmamRo4c6XTus2fPVmZmptN+fj2mISEhkv5v/H7LbrfLz8/PaQEAANWT22ci69Wrp5YtWzqtO3TokEv7qlOnjuNvm8120XXFxcWSpIKCAj344IMaP358iX01adKk1GPs2LHDMVPXpUsXffTRR+rfv7+OHz+ulStX6r777rtsnS+//LIeffRRDRgwQP/973/Vs2fPMp7heWV58ObX5y2dP/cLl/ELCgokSa+++qq6d+/u1O/Xl8R/u5/fjh8AAKi53B4iy6Jt27ZKS0tzWpeWlqZWrVqVCD0munTpol27dpUIsZdyzTXXaN26dZo6daqk8zOiH374oW699VY1aNDgsvdTSufD2CuvvCIPDw8NHDhQH3/8sXr16lVqX09PzxKX9yMjI3Xo0CHt2bPnkrORFxMUFKTQ0FB99913SkhIMN4eAADA7Zezy2LSpElavXq1/vrXv2rPnj167bXXtGDBAqcHRVwxZcoUrV+/XmPHjlV6err27t2rFStWXDIIPvLII1q5cqXGjBmjr7/+Wtu2bVNqaqo8PT117Ngx/ec//ynTsW02mxYtWqRhw4Zp4MCBSklJKbVfeHi4srKylJ6eruPHj+v06dPq1auXevbsqcGDB2vVqlXKysrSJ598YvSgz6xZszRnzhzNnz9fe/bs0c6dO7VkyRI9++yzZd4HAACoua6KENmlSxe99957euedd9ShQwdNnz5dTzzxhNNDNa6IjIxUamqq9uzZo5tuukmdO3fW9OnTFRoaetFtYmNjtXr1au3cuVM9evRQ3759tXv3bm3atEmzZs3S8OHDtX79+jId32az6cUXX9R9992nW265RWvWrCnRZ/DgwYqNjVWfPn0UGBiot99+W9L5nzzq1q2bhgwZonbt2unRRx8tMWN5Kffff78WL16sJUuWqGPHjurVq5eSkpLUrFmzMu8DAADUXDbrwo1yQDnLy8uTv7+/Oo1bpFp2fkAdAHD12fL0MHeXUOkufH/n5uZe8iHZq2ImEgAAAFULIRIAAADGCJEAAAAwRogEAACAMUIkAAAAjBEiAQAAYIwQCQAAAGOESA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QXXfdpaKiIn300UeOvkePHtXHH3+sESNGXHR/p0+fVl5entMCAACqp9ruLqAmS05Olo+PjySpsLBQISEhSk5OloeHh9566y0VFxdr8eLFstlskqQlS5YoICBAKSkp6tevn/r27eu0v1deeUUBAQFKTU0t02XxWrVqqUGDBpKkxo0bKyAgwNF27733asmSJbrrrrskSW+88YaaNGmi3r17X3R/c+bM0axZs0yGAAAAXKWYiXSjPn36KD09Xenp6dq0aZP69++vAQMG6Pvvv9f27du1b98++fr6ysfHRz4+PmrQoIFOnTqlzMxMSdKRI0c0atQoRUREyN/fX35+fiooKNCBAweuuLZRo0bps88+0w8//CBJSkpKcjwMdDFTp05Vbm6uYzl48OAV1wEAAKomZiLdqF69emrZsqXj9eLFi+Xv769XX31VBQUF6tq1q958880S2wUGBkqSEhMT9eOPP+qFF15Q06ZNZbfbFRUV5bjc7eFx/v8RLMtybHv27Nky1da5c2d16tRJS5cuVb9+/fTNN9/o448/vuQ2drtddru9TPsHAABXN0JkFWKz2eTh4aFffvlFXbp00bvvvqvGjRvLz8+v1P5paWl66aWXNHDgQEnnH8Q5fvy4o/1C2MzOzlbnzp0lyekhG0ny9PSUJBUVFZXY//3336/nn39eP/zwg2JiYhQWFnbF5wgAAKoHLme70enTp5WTk6OcnBxlZGRo3LhxKigo0G233aaEhAQ1atRIcXFxWrdunbKyspSSkqLx48fr0KFDkqSIiAi9/vrrysjI0JdffqmEhAR5e3s79u/t7a3f/e53mjt3rjIyMpSamqq//OUvTjU0bdpUNptNycnJOnbsmAoKChxt9957rw4dOqRXX331kg/UAACAmocQ6UYrV65USEiIQkJC1L17d23evFnvv/++evfurbp162rt2rVq0qSJ7rjjDrVt21YjR47UqVOnHDOT//znP/XTTz+pS5cuGjp0qMaPH6/GjRs7HeNf//qXzp07p65du2rChAmaPXu2U/s111yjWbNm6bHHHlNQUJDGjh3raPP399fgwYPl4+OjQYMGVfh4AACAq4fN+vUNc8BvREdHq3379po/f77xtnl5efL391encYtUy+59+Q2ACrbl6W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Jk6cqBkzZmjr1q3q1KmT+vfvr6NHj7q7tCqhffv2ys7OdixffPGFo+1Pf/qT/vOf/+j9999XamqqDh8+rDvuuMON1VauwsJCderUSS+++GKp7X//+981f/58LVq0SF9++aXq1aun/v3769SpU44+CQkJ+uabb7Rq1SolJydr7dq1euCBByrrFCrV5cZLkmJjY53eb2+//bZTe00Zr9TUVI0ZM0YbN27UqlWrdPbsWfXr10+FhYWOPpf7/BUVFemWW27RmTNntH79er322mtKSkrS9OnT3XFKFaos4yVJo0aNcnp//f3vf3e01aTxuvbaazV37lxt2bJFX331lfr27au4uDh98803kqrxe8sCytkNN9xgjRkzxvG6qKjICg0NtebMmePGqqqGGTNmWJ06dSq17eTJk1adOnWs999/37EuIyPDkmRt2LChkiqsOiRZH374oeN1cXGxFRwcbD399NOOdSdPnrTsdrv19ttvW5ZlWbt27bIkWZs3b3b0+eSTTyybzWb98MMPlVa7O/x2vCzLshITE624uLiLblOTx+vo0aOWJCs1NdWyrLJ9/v773/9aHh4eVk5OjqPPwoULLT8/P+v06dOVewKV7LfjZVmW1atXL+uPf/zjRbepyeNlWZZVv359a/HixdX6vcVMJMrVmTNntGXLFsXExDjWeXh4KCYmRhs2bHBjZVXH3r17FRoaqubNmyshIUEHDhyQJG3ZskVnz551Grs2bdqoSZMmjJ2krKws5eTkOI2Pv7+/unfv7hifDRs2KCAgQNdff72jT0xMjDw8PPTll19Wes1VQUpKiho3bqzWrVvr4Ycf1o8//uhoq8njlZubK0lq0KCBpLJ9/jZs2KCOHTsqKCjI0ad///7Ky8tzzDhVV78drwvefPNNNWrUSB06dNDUqVP1888/O9pq6ngVFRXpnXfeUWFhoaKioqr1e6u2uwtA9XL8+HEVFRU5fRAkKSgoSN9++62bqqo6unfvrqSkJLVu3VrZ2dmaNWuWbrrpJn399dfKycmRp6enAgICnLYJCgpSTk6OewquQi6MQWnvrQttOTk5aty4sVN77dq11aBBgxo5hrGxsbrjjjvUrFkzZWZm6vHHH9eAAQO0YcMG1apVq8aOV3FxsSZMmKAePXqoQ4cOklSmz19OTk6p778LbdVVaeMlSffee6+aNm2q0NBQ7dixQ1OmTNHu3bu1bNkySTVvvHbu3KmoqCidOnVKPj4++vDDD9WuXTulp6dX2/cWIRKoRAMGDHD8HRkZqe7du6tp06Z677335O3t7cbKUB3dc889jr87duyoyMhItWjRQikpKYqOjnZjZe41ZswYff311073I+PiLjZev753tmPHjgoJCVF0dLQyMzPVokWLyi7T7Vq3bq309HTl5ubq3//+txITE5WamurusioUl7NRrho1aqRatWqVeOrsyJEjCg4OdlNVVVdAQIBatWqlffv2KTg4WGfOnNHJkyed+jB2510Yg0u9t4KDg0s8wHXu3DmdOHGCMZTUvHlzNWrUSPv27ZNUM8dr7NixSk5O1po1a3Tttdc61pfl8xccHFzq++9CW3V0sfEqTffu3SXJ6f1Vk8bL09NTLVu2VNeuXTVnzhx16tRJL7zwQrV+bxEiUa48PT3VtWtXrV692rGuuLhYq1evVlRUlBsrq5oKCgqUmZmpkJAQde3aVXXq1HEau927d+vAgQOMnaRmzZopODjYaXzy8vL05ZdfOsYnKipKJ0+e1JYtWxx9/ve//6m4uNjxBVeTHTp0SD/++KNCQkIk1azxsixLY8eO1Ycffqj//e9/atasmVN7WT5/UVFR2rlzp1PwXrVqlfz8/NSuXbvKOZFKcrnxKk16erokOb2/asp4laa4uFinT5+u3u8tdz/Zg+rnnXfesex2u5WUlGTt2rXLeuCBB6yAgACnp85qqkmTJlkpKSlWVlaWlZaWZsXExFiNGjWyjh49almWZT300ENWkyZNrP/973/WV199ZUVFRVlRUVFurrry5OfnW9u2bbO2bdtmSbKeffZZa9u2bdb3339vWZZlzZ071woICLBWrFhh7dixw4qLi7OaNWtm/fLLL459xMbGWp07d7a+/PJL64svvrAiIiKsIUOGuOuUKtSlxis/P9+aPHmytWHDBisrK8v6/PPPrS5dulgRERHWqVOnHPuoKeP18MMPW/7+/lZKSoqVnZ3tWH7++WdHn8t9/s6dO2d16NDB6tevn5Wenm6tXLnSCgwMtKZOneqO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iASAGsTb2/uKtvfw8JBlWU7rzp49W6JfnTp1nF7bbDYVFxdf0bEBVC2ESACoQSIiIuTt7a3Vq1eXaGvbtq22b9+uwsJCx7q0tDR5eHiodevWkqTAwEBlZ2c72ouKivT1118b1eDp6enYFsDVixAJADWIl5eXpkyZokcffVRLly5VZmamNm7cqH/+859KSEiQl5eXEhMT9fXXX2vNmjUaN26chg4d6rgfsm/fvvr444/18ccf69tvv9XDDz+skydPGtXQuHFjeXt7a+XKlTpy5Ihyc3Mr4EwBVDRCJADUMNOmTdOkSZM0ffp0tW3bVvHx8Tp69Kjq1q2rTz/9VCdOnFC3bt105513Kjo6WgsWLHBsO2LECCUmJmrYsGHq1auXmjdvrj59+hgdv3bt2po/f75efvllhYaGKi4urrxPEUAlsFm/vbkFAAAAuAxmIgEAAGCMEAkAAABjhEgAAAAYI0QCAADAGCESAAAAxgiRAAAAMEaIBAAAgDFCJAAAAIwRIgEAAGCMEAkAAABjhEgAAAAY+/9QIWeGfQrFTgAAAABJRU5ErkJggg==",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "sns.countplot(df_ph_final['category']);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 256,
   "id": "c34e8603-d749-4a84-8d68-8712d0824a3f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Axes: xlabel='time_spent', ylabel='Count'>"
      ]
     },
     "execution_count": 256,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAjIAAAGxCAYAAAB4AFyyAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8WgzjOAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAxUklEQVR4nO3df1RU9b7/8deo/DKdQUT5kSBkCmpZph2kH6dSjugtlx653eroTd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K4b5sknnzS2bt1qFBUVGXv37jWefPJJw2azGZ9++qlhGOa/pwkyF3HXXXcZUVFRRmBgoHH55Zcbd911l3Ho0CHPeFVVlfHQQw8ZnTp1Mtq3b2/8/ve/N0pKSkzs2Do2b95sSDpvGzdunGEY//gK9uzZs42IiAgjKCjIGDJkiFFYWOhV48SJE8Y999xjdOjQwbDb7cZ9991nnDx50oRX499+aa4rKyuNoUOHGl26dDECAgKM7t27G5MmTfL6qqRhMNcNUd8cSzKys7M9xzTkb8bhw4eN4cOHGyEhIUZ4eLjxyCOPGDU1NS38avzbxea6uLjY+O1vf2uEhYUZQUFBxpVXXmk89thjRkVFhVcd5vriJkyYYHTv3t0IDAw0unTpYgwZMsQTYgzD/Pc0d78GAACWxRoZAABgWQQZAABgWQQZAABgWQQZAABgWQQZAABgWQQZAABgWQQZAABgWQQZAABgWQQZAE22ZcsW2Wy2824YBwAthSADoMFuvfVWzZgxw/P4hhtuUElJiRwOh3lN+YHDhw/LZrN5bkoIoOW0M7sBANYVGBioyMhIs9sAcAnjjAyABhk/fry2bt2ql156STabTTabTStXrvT6aGnlypUKDQ3VBx98oISEBLVv317/+q//qsrKSq1atUpxcXHq1KmTpk+frtraWk9tt9utRx99VJdffrkuu+wyJSUlacuWLQ3q64cfftCIESPUqVMnXXbZZerbt68++ugjSf/30deHH36ofv36KTg4WIMGDVJBQYFXjW3btunmm29WSEiIYmJiNH36dJ0+fdozHhcXp+eee04TJkxQx44dFRsbq+XLl3vG4+PjJUn9+/eXzWbTrbfe2oQZBtAUBBkADfLSSy8pOTlZkyZNUklJiUpKShQTE3PecZWVlVqyZInWrFmjDRs2aMuWLfr973+vjz76SB999JH+93//V6+88or+/Oc/e54zdepU5ebmas2aNdq7d6/uvPNODRs2TAcPHrxoX+np6XK73fr888+1b98+Pf/88+rQoYPXMY899phefPFF7dy5U126dNGIESNUU1MjSfr+++81bNgwpaWlae/evXrrrbe0bds2TZ061avGiy++qIEDB2r37t166KGHNGXKFBUWFkqSvvzyS0nSxo0bVVJSonfeeadxkwug6XxyD20Al4RbbrnFePjhhz2PN2/ebEgyfvrpJ8MwDCM7O9uQZBw6dMhzzAMPPGC0b9/eOHnypGdfamqq8cADDxiGYRg//PCD0bZtW+Po0aNev2vIkCFGRkbGRXu6+uqrjaeffrresXP9rVmzxrPvxIkTRkhIiPHWW28ZhmEYEydONCZPnuz1vL/85S9GmzZtjKqqKsMwDKN79+7G2LFjPeN1dXVG165djWXLlhmGYRhFRUWGJGP37t0X7ReAb7FGBoBPtW/fXj169PA8joiIUFxcnNdZkoiICB0/flyStG/fPtXW1qpXr15eddxutzp37nzR3zd9+nRNmTJFn376qVJSUpSWlqZ+/fp5HZOcnOz5OSwsTAkJCdq/f78k6euvv9bevXv1xhtveI4xDEN1dXUqKipS7969Jcmrps1mU2RkpOc1ADAPQQaATwUEBHg9ttls9e6rq6uTJJ06dUpt27ZVfn6+2rZt63Xczz8iqs/999+v1NRUffjhh/r000+VmZmpF198UdOmTWtQv6dOndIDDzyg6dOnnzcWGxv7i6/r3GsAYB6CDIAGCwwM9Fqk6wv9+/dXbW2tjh8/rptvvrlJNWJiYvTggw/qwQcfVEZGhl599VWvILNjxw5PKPnpp5/03Xffec60XHfddfr222915ZVXNvk1BAYGSpLP5wbAxbHYF0CDxcXFKS8vT4cPH1ZZWZlPzkj06tVLY8aM0b333qt33nlHRUVF+vLLL5WZmakPP/zwos+fMWOGPvnkExUVFemrr77S5s2bPSHlnPnz5ysnJ0cFBQUaP368wsPDNWrUKEnSE088oe3bt2vq1Knas2ePDh48qHffffe8xb6/pGvXrgoJCdGGDRtUWlqqioqKRs0BgKYjyABosEcffVRt27ZVnz591KVLFxUXF/ukbnZ2tu6991498sgjSkhI0KhRo7Rz506vj3YupLa2Vunp6erdu7eGDRumXr16aenSpV7HLFiwQA8//LAGDBggp9Op999/33MWpV+/ftq6dau+++473Xzzzerfv7/mzJmj6OjoBvffrl07LVmyRK+88oqio6M1cuTIxk0AgCazGYZhmN0EADSHLVu26LbbbtNPP/2k0NBQs9sB0Aw4IwMAACyLIAPArw0fPlwdOnSod3vuuefMbg+AyfhoCYBfO3r0qKqqquodCwsLU1hYWAt3BMCfEGQAAIBl8dESAACwLIIMAACwLIIMAACwLIIMAACwLIIMAACwLIIMAACwLIIMAACwLIIMAACwrP8PWuPJAkRvTjcAAAAASUVORK5CYII=",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "sns.histplot(df_ph_final['time_spent'], bins=20)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 257,
   "id": "82aa5fbf-4ca3-44e7-8e95-672a361652eb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Axes: xlabel='page_views', ylabel='Count'>"
      ]
     },
     "execution_count": 257,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAjsAAAGxCAYAAACEFXd4AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8WgzjOAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAsLUlEQVR4nO3df1RVdb7/8RcmIiaghPLDOEJpgJk6pRFZaYmhTS0dnXs1dZalo02JP5tyqIwkHcq6RZrprRl/3SVazaRZM9kUJuVIaJiZBaSOznEUcI4FRwWRZH//8Hbu96Sk4jmcw4fnY629Fmfvfd68+azd8tX+8dkBlmVZAgAAMFQrXzcAAADgTYQdAABgNMIOAAAwGmEHAAAYjbADAACMRtgBAABGI+wAAACjEXYAAIDRWvu6AX9QX1+vw4cPKyQkRAEBAb5uBwAAXADLsnTs2DHFxMSoVauGz98QdiQdPnxYsbGxvm4DAAA0wsGDB3XllVc2uJ2wIykkJETSmcEKDQ31cTcAAOBCOJ1OxcbGuv4dbwhhR3JdugoNDSXsAADQzJzvFhRuUAYAAEYj7AAAAKMRd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kigr16dOnwboZGRmaNWuW67PT6STwAABgqEaFnV27drnCxO7du922efJm5f79+6u0tNRt3TfffKOuXbtKOnOzclRUlPLy8lz9OJ1OFRYW6sEHH2ywblBQkIKCgjzWJwAA8F+NCjsfffSRp/s4p5kzZ+rmm2/W73//e/3nf/6ntm3bpldffVWvvvqqpDPBasaMGZo3b566d+/uevQ8JibGNdszAABo2Ro9z05T6Nevn9atW6eMjAxlZWUpPj5eOTk5Gjt2rGufRx99VCdOnNDkyZNVWVmpW265RRs3bmSOHQAAIKmRYef222//yctVmzZtanRDP3b33Xfr7rvvbnB7QECAsrKylJWV5bHfCQAAzNGosPPjm3/r6uq0c+dO7d69+6wXhAIAAPhSo8LOiy++eM71Tz31lI4fP35JDQEAAHhSo+bZaci4ceM89l4sAAAAT/Bo2CkoKODGYAAA4FcadRlrxIgRbp8ty1JZWZk+++wzzZkzxyONAQAAeEKjwk5YWJjb51atWikhIUFZWVm68847PdIYAACAJzQq7CxfvtzTfQAAAHjFJU0qWFRUpOLiYknStddeq5/97GceaQoAAMBTGhV2jhw5otGjR2vz5s3q0KGDJKmyslK333671q5dq06dOnmyRwAAgEZrVNiZOnWqjh07pq+++kpJSUmSpK+//lrjx4/XtGnTtGbNGo82CZjIbrfL4XB4pXZERIRsNptXagNAc9OosLNx40Z9+OGHrqAjST169NDixYu5QRm4AHa7XYmJSaqpqfZK/eDgdiopKSbwAIAaGXbq6+sVGBh41vrAwEDV19dfclOA6RwOh2pqqpU8IVOh0XEere0sO6DCZXPlcDgIOwCgRoadO+64Q9OnT9eaNWsUExMjSTp06JBmzpypQYMGebRBwGSh0XEKtyX4ug0AMFqjZlB++eWX5XQ6FRcXp6uvvlpXX3214uPj5XQ6tWjRIk/3CAAA0GiNOrMTGxurHTt26MMPP1RJSYkkKSkpSampqR5tDgAA4FJd1JmdTZs2qUePHnI6nQoICNDgwYM1depUTZ06Vf369dO1116rTz75xFu9AgAAXLSLCjs5OTmaNGmSQkNDz9oWFhamBx54QC+88ILH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Hz81Hv5wbPDWcwAAYDTu2QEAAEYj7AAAAKMRdgAAgNEIOwAAwGiEHQAAYDTCDgAAMBphBwAAGI2wAwAAjEbYAQBJ9913n9GvAwFaMmZQBgBJVVVVsixLHTp08HUrADyMsAMAAIzGZSwAl2zgwIFKT09Xenq6wsLCFBERoTlz5uiH/5f6n//5H/Xt21chISGKiorSmDFjdOTIEbcaGzZsUPfu3dW2bVvdfvvtWrlypQICAlRZWenaZ8uWLbr11lsVHBys2NhYTZs2TSdOnDhvf4899piSk5PPWt+7d29lZWVJOvsyVn19vbKzsxUfH6/g4GD17t1bf/rTn1zb+/btq+eff971efjw4QoMDNTx48clSf/6178UEBDgepP8K6+84vr7IiMj9ctf/vK8fQPwDMIOAI9YuXKlWrdurW3btumll17SCy+8oD/84Q+SpLq6Oj399NP64osvtH79eh04cED33Xef67v79+/XL3/5Sw0fPlxffPGFHnjgAT3++ONu9fft26chQ4Zo5MiR2rVrl15//XVt2bJF6enp5+1t7Nix2rZtm/bt2+da99VXX2nXrl0aM2bMOb+TnZ2tVatWaenSpfrqq680c+ZMjRs3Tvn5+ZKkAQMGaPPmzZIky7L0ySefqEOHDtqyZYskKT8/X126dFG3bt302Wefadq0acrKylJpaak2btyo22677YLHFsAlarL3qwMw1oABA6ykpCSrvr7etW727NlWUlLSOfffvn27Jck6duyYa9+ePXu67fP4449bkqzvvvvOsizLmjhxojV58mS3fT755BOrVatWVk1NzXl77N27t5WVleX6nJGRYSUnJ7s+jx8/3ho2bJhlWZZ18uRJq127dtbWrVvdakycONG69957LcuyrA0bNlhhYWHW999/b+3cudOKioqypk+fbs2ePduyLMv69a9/bY0ZM8ayLMv685//bIWGhlpOp/O8fQLwPM7sAPCIm266SQEBAa7PKSkp2rNnj06fPq2ioiLdc889stlsCgkJ0YABAyRJdrtdklRaWqp+/fq51bvxxhvdPn/xxRdasWKF2rdv71rS0tJUX1+v/fv3n7e/sWPHKjc3V9KZMzFr1qzR2LFjz7nv3r17VV1drcGDB7v9vlWrVrnODt166606duyYPv/8c+Xn52vAgAEaOHCg62xPfn6+Bg4cKEkaPHiwunbtqquuukq/+tWvtHr1alVXV5+3ZwCe0drXDQAw28mTJ5WWlqa0tDStXr1anTp1kt1uV1pamk6dOnXBdY4fP64HHnhA06ZNO2ubzWY77/fvvfdezZ49Wzt27FBNTY0OHjyoUaNGNfi7JOkvf/mLunTp4rYtKChIktShQwf17t1bmzdvVkFBgQYPHqzbbrtNo0aN0jfffKM9e/a4Ql1ISIh27NihzZs3629/+5uefPJJPfXUU9q+fTtPfwFNgLADwCMKCwvdPn/66afq3r27SkpKdPToUT3zzDOKjY2VJH322Wdu+yYkJOivf/2r27rt27e7fb7++uv19ddfq1u3bo3q78orr9SAAQO0evVq1dTUaPDgwercufM59+3Ro4eCgoJkt9tdgeVcBgwYoI8++kjbtm3T/PnzFR4erqSkJM2fP1/R0dG65pprXPu2bt1aqampSk1NVWZmpjp06KBNmzZpxIgRjfp7AFw4LmMB8Ai73a5Zs2aptLRUa9as0aJFizR9+nTZbDa1adNGixYt0j/+8Q9t2LBBTz/9tNt3H3jgAZWUlGj27Nn65ptv9MYbb2jFihWS5Lo0Nnv2bG3dulXp6enauXOn9uzZo7fffvuCblD+wdixY7V27Vq9+eabDV7Cks6cifntb3+rmTNnauXKldq3b5927NihRYsWaeXKla79Bg4cqPfff1+tW7dWYmKia93q1avdQtK7776rhQsXaufOnfrnP/+pVatWqb6+XgkJCRfcO4BL4OubhgA0fwMGDLAeeugh6ze/+Y0VGhpqdezY0XrsscdcNyzn5uZacXFxVlBQkJWSkmJt2LDBkmR9/vnnrhpvv/221a1bNysoKMgaOHCgtWTJEkuS283H27ZtswYPHmy1b9/euvzyy61evXpZ8+fPv+A+v/vuOysoKMhq166d6+boH/z/NyhblmXV19dbOTk5VkJCghUYGGh16tTJSktLs/Lz8137HD161AoICLBGjRrlWrdu3TpLkrV06VLXuk8++cQaMGCA1bFjRys4ONjq1auX9frrr19w3wAuDZMKArhkAwcOVJ8+fZSTk+OxmvPnz9fSpUt18OBBj9UE0DJxzw4Av/DKK6+oX79+uuKKK/T3v/9dzz333EVdogKAhhB2APiFPXv2aN68efr2229ls9n08MMPKyMj44K++8knn2jo0KENbv/h6SoALROXsQA0ezU1NTp06FCD2xv7BBcAMxB2AACA0Xj0HAAAGI2wAwAAjEbYAQAARiPsAAAAoxF2AACA0Qg7AADAaIQdAABgNMIOAAAw2v8DKyInDBmx7uoAAAAASUVORK5CYII=",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "sns.histplot(df_ph_final['page_views'], bins=20)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6cfe0417-c13e-4a7d-889d-39e9bc50e75c",
   "metadata": {},
   "source": [
    "- distribution of category, time spent and page views variables"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 258,
   "id": "ae2bcbc4-853b-4098-af03-27a171ea1da2",
   "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 tr th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr:last-of-type th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th colspan=\"2\" halign=\"left\">price</th>\n",
       "      <th colspan=\"2\" halign=\"left\">page_views</th>\n",
       "      <th colspan=\"2\" halign=\"left\">time_spent</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th>sum</th>\n",
       "      <th>mean</th>\n",
       "      <th>sum</th>\n",
       "      <th>mean</th>\n",
       "      <th>sum</th>\n",
       "      <th>mean</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>customer_id</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>6756</td>\n",
       "      <td>519.692308</td>\n",
       "      <td>325</td>\n",
       "      <td>25.0</td>\n",
       "      <td>1560</td>\n",
       "      <td>120.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>4098</td>\n",
       "      <td>372.545455</td>\n",
       "      <td>220</td>\n",
       "      <td>20.0</td>\n",
       "      <td>990</td>\n",
       "      <td>90.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>11587</td>\n",
       "      <td>551.761905</td>\n",
       "      <td>630</td>\n",
       "      <td>30.0</td>\n",
       "      <td>3150</td>\n",
       "      <td>150.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4542</td>\n",
       "      <td>324.428571</td>\n",
       "      <td>210</td>\n",
       "      <td>15.0</td>\n",
       "      <td>1120</td>\n",
       "      <td>80.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>5715</td>\n",
       "      <td>519.545455</td>\n",
       "      <td>242</td>\n",
       "      <td>22.0</td>\n",
       "      <td>1210</td>\n",
       "      <td>110.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>96</th>\n",
       "      <td>5888</td>\n",
       "      <td>490.666667</td>\n",
       "      <td>144</td>\n",
       "      <td>12.0</td>\n",
       "      <td>3360</td>\n",
       "      <td>280.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>988</td>\n",
       "      <td>197.600000</td>\n",
       "      <td>125</td>\n",
       "      <td>25.0</td>\n",
       "      <td>680</td>\n",
       "      <td>136.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>4879</td>\n",
       "      <td>443.545455</td>\n",
       "      <td>242</td>\n",
       "      <td>22.0</td>\n",
       "      <td>572</td>\n",
       "      <td>52.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>3547</td>\n",
       "      <td>394.111111</td>\n",
       "      <td>117</td>\n",
       "      <td>13.0</td>\n",
       "      <td>1629</td>\n",
       "      <td>181.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>100</th>\n",
       "      <td>5552</td>\n",
       "      <td>504.727273</td>\n",
       "      <td>319</td>\n",
       "      <td>29.0</td>\n",
       "      <td>1133</td>\n",
       "      <td>103.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>100 rows × 6 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "             price             page_views       time_spent       \n",
       "               sum        mean        sum  mean        sum   mean\n",
       "customer_id                                                      \n",
       "1             6756  519.692308        325  25.0       1560  120.0\n",
       "2             4098  372.545455        220  20.0        990   90.0\n",
       "3            11587  551.761905        630  30.0       3150  150.0\n",
       "4             4542  324.428571        210  15.0       1120   80.0\n",
       "5             5715  519.545455        242  22.0       1210  110.0\n",
       "...            ...         ...        ...   ...        ...    ...\n",
       "96            5888  490.666667        144  12.0       3360  280.0\n",
       "97             988  197.600000        125  25.0        680  136.0\n",
       "98            4879  443.545455        242  22.0        572   52.0\n",
       "99            3547  394.111111        117  13.0       1629  181.0\n",
       "100           5552  504.727273        319  29.0       1133  103.0\n",
       "\n",
       "[100 rows x 6 columns]"
      ]
     },
     "execution_count": 258,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_ph_final.groupby(['customer_id']).agg({\n",
    "    'price' : ['sum', 'mean'],\n",
    "    'page_views' : ['sum', 'mean'],\n",
    "    'time_spent': ['sum', 'mean']\n",
    "})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 259,
   "id": "0e0db145-c718-4d9d-8034-5519f1756c1b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "purchase_date\n",
       "2023-01-02    220\n",
       "2023-01-03    208\n",
       "2023-01-01    199\n",
       "2023-01-05    193\n",
       "2023-01-04    180\n",
       "Name: count, dtype: int64"
      ]
     },
     "execution_count": 259,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_ph_final['purchase_date'].value_counts()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "db2d93bb-ae4c-47a9-82ad-d43bf81f85ed",
   "metadata": {},
   "source": [
    "## Data Preprocessing"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 260,
   "id": "7b4c2115-bcfd-4b3f-919c-cc3a95471326",
   "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>customer_id</th>\n",
       "      <th>product_id</th>\n",
       "      <th>purchase_date</th>\n",
       "      <th>page_views</th>\n",
       "      <th>time_spent</th>\n",
       "      <th>category</th>\n",
       "      <th>price</th>\n",
       "      <th>ratings</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>101</td>\n",
       "      <td>2023-01-01</td>\n",
       "      <td>25</td>\n",
       "      <td>120</td>\n",
       "      <td>Electronics</td>\n",
       "      <td>500</td>\n",
       "      <td>4.50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>3</td>\n",
       "      <td>101</td>\n",
       "      <td>2023-01-01</td>\n",
       "      <td>30</td>\n",
       "      <td>150</td>\n",
       "      <td>Electronics</td>\n",
       "      <td>500</td>\n",
       "      <td>4.50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>101</td>\n",
       "      <td>2023-01-03</td>\n",
       "      <td>30</td>\n",
       "      <td>150</td>\n",
       "      <td>Electronics</td>\n",
       "      <td>500</td>\n",
       "      <td>4.50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>101</td>\n",
       "      <td>2023-01-02</td>\n",
       "      <td>15</td>\n",
       "      <td>80</td>\n",
       "      <td>Electronics</td>\n",
       "      <td>500</td>\n",
       "      <td>4.50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>101</td>\n",
       "      <td>2023-01-05</td>\n",
       "      <td>22</td>\n",
       "      <td>110</td>\n",
       "      <td>Electronics</td>\n",
       "      <td>500</td>\n",
       "      <td>4.50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>995</th>\n",
       "      <td>21</td>\n",
       "      <td>106</td>\n",
       "      <td>2023-01-05</td>\n",
       "      <td>26</td>\n",
       "      <td>100</td>\n",
       "      <td>Home &amp; Kitchen</td>\n",
       "      <td>678</td>\n",
       "      <td>2.74</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>996</th>\n",
       "      <td>17</td>\n",
       "      <td>106</td>\n",
       "      <td>2023-01-01</td>\n",
       "      <td>16</td>\n",
       "      <td>280</td>\n",
       "      <td>Home &amp; Kitchen</td>\n",
       "      <td>678</td>\n",
       "      <td>2.74</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>997</th>\n",
       "      <td>43</td>\n",
       "      <td>106</td>\n",
       "      <td>2023-01-05</td>\n",
       "      <td>6</td>\n",
       "      <td>217</td>\n",
       "      <td>Home &amp; Kitchen</td>\n",
       "      <td>678</td>\n",
       "      <td>2.74</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>998</th>\n",
       "      <td>91</td>\n",
       "      <td>106</td>\n",
       "      <td>2023-01-01</td>\n",
       "      <td>29</td>\n",
       "      <td>234</td>\n",
       "      <td>Home &amp; Kitchen</td>\n",
       "      <td>678</td>\n",
       "      <td>2.74</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>999</th>\n",
       "      <td>90</td>\n",
       "      <td>106</td>\n",
       "      <td>2023-01-04</td>\n",
       "      <td>11</td>\n",
       "      <td>213</td>\n",
       "      <td>Home &amp; Kitchen</td>\n",
       "      <td>678</td>\n",
       "      <td>2.74</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1000 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     customer_id  product_id purchase_date  page_views  time_spent  \\\n",
       "0              1         101    2023-01-01          25         120   \n",
       "1              3         101    2023-01-01          30         150   \n",
       "2              3         101    2023-01-03          30         150   \n",
       "3              4         101    2023-01-02          15          80   \n",
       "4              5         101    2023-01-05          22         110   \n",
       "..           ...         ...           ...         ...         ...   \n",
       "995           21         106    2023-01-05          26         100   \n",
       "996           17         106    2023-01-01          16         280   \n",
       "997           43         106    2023-01-05           6         217   \n",
       "998           91         106    2023-01-01          29         234   \n",
       "999           90         106    2023-01-04          11         213   \n",
       "\n",
       "           category  price  ratings  \n",
       "0       Electronics    500     4.50  \n",
       "1       Electronics    500     4.50  \n",
       "2       Electronics    500     4.50  \n",
       "3       Electronics    500     4.50  \n",
       "4       Electronics    500     4.50  \n",
       "..              ...    ...      ...  \n",
       "995  Home & Kitchen    678     2.74  \n",
       "996  Home & Kitchen    678     2.74  \n",
       "997  Home & Kitchen    678     2.74  \n",
       "998  Home & Kitchen    678     2.74  \n",
       "999  Home & Kitchen    678     2.74  \n",
       "\n",
       "[1000 rows x 8 columns]"
      ]
     },
     "execution_count": 260,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_ph_final"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ba9ccc12-53fd-465b-8f29-e4bd9d3be185",
   "metadata": {},
   "source": [
    "- the data seems good and no need for data preprocessing"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c446b5de-46b1-4ccf-91ce-417fe350b48e",
   "metadata": {},
   "source": [
    "## Model Development\n",
    "- using KNNwithMeans from scikit surprise\n",
    "- this model capables to find nearest neighbors and predict the ratings (to indicate user preference)\n",
    "- our goal is to predict top 5 product with highest ratings related to customers\n",
    "- my hipothesis is higher ratings mean higher probability customers will buy the products"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 373,
   "id": "cfbffc6d-7c44-4449-9d95-cad2db7104a4",
   "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>customer_id</th>\n",
       "      <th>product_id</th>\n",
       "      <th>purchase_date</th>\n",
       "      <th>page_views</th>\n",
       "      <th>time_spent</th>\n",
       "      <th>category</th>\n",
       "      <th>price</th>\n",
       "      <th>ratings</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>101</td>\n",
       "      <td>2023-01-01</td>\n",
       "      <td>25</td>\n",
       "      <td>120</td>\n",
       "      <td>Electronics</td>\n",
       "      <td>500</td>\n",
       "      <td>4.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>3</td>\n",
       "      <td>101</td>\n",
       "      <td>2023-01-01</td>\n",
       "      <td>30</td>\n",
       "      <td>150</td>\n",
       "      <td>Electronics</td>\n",
       "      <td>500</td>\n",
       "      <td>4.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>101</td>\n",
       "      <td>2023-01-03</td>\n",
       "      <td>30</td>\n",
       "      <td>150</td>\n",
       "      <td>Electronics</td>\n",
       "      <td>500</td>\n",
       "      <td>4.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>101</td>\n",
       "      <td>2023-01-02</td>\n",
       "      <td>15</td>\n",
       "      <td>80</td>\n",
       "      <td>Electronics</td>\n",
       "      <td>500</td>\n",
       "      <td>4.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>101</td>\n",
       "      <td>2023-01-05</td>\n",
       "      <td>22</td>\n",
       "      <td>110</td>\n",
       "      <td>Electronics</td>\n",
       "      <td>500</td>\n",
       "      <td>4.5</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   customer_id  product_id purchase_date  page_views  time_spent     category  \\\n",
       "0            1         101    2023-01-01          25         120  Electronics   \n",
       "1            3         101    2023-01-01          30         150  Electronics   \n",
       "2            3         101    2023-01-03          30         150  Electronics   \n",
       "3            4         101    2023-01-02          15          80  Electronics   \n",
       "4            5         101    2023-01-05          22         110  Electronics   \n",
       "\n",
       "   price  ratings  \n",
       "0    500      4.5  \n",
       "1    500      4.5  \n",
       "2    500      4.5  \n",
       "3    500      4.5  \n",
       "4    500      4.5  "
      ]
     },
     "execution_count": 373,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_ph_final.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 414,
   "id": "8734beed-20df-49e9-ac21-754adfc1639c",
   "metadata": {},
   "outputs": [],
   "source": [
    "reader = Reader(rating_scale=(1, 5))\n",
    "\n",
    "# Loads Pandas dataframe\n",
    "data = Dataset.load_from_df(df_ph_final[[\"customer_id\", \"product_id\", \"ratings\"]], reader)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3727fb26-8d6d-4438-a9e9-eff23df5220c",
   "metadata": {},
   "source": [
    "- create datasets"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 415,
   "id": "6c266fed-6d16-4633-b002-ca1f13bda70a",
   "metadata": {},
   "outputs": [],
   "source": [
    "sim_options = {\n",
    "    \"name\": \"cosine\",\n",
    "    \"user_based\": True,\n",
    "}\n",
    "algo = KNNWithMeans(sim_options=sim_options)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d3d689ac-1d96-4a7c-8889-9592c6ef1a13",
   "metadata": {},
   "source": [
    "- define models"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 416,
   "id": "f1f15533-473d-4571-80e6-f54a51ccd85c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Computing the cosine similarity matrix...\n",
      "Done computing similarity matrix.\n"
     ]
    }
   ],
   "source": [
    "trainset, testset = train_test_split(data, test_size=0.25)\n",
    "algo.fit(trainset)\n",
    "predictions = algo.test(testset)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "61942c65-fefc-4cb2-9532-714058513884",
   "metadata": {},
   "source": [
    "- training for the models"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 417,
   "id": "a7b4cf3e-d850-4dc8-b5bf-7841586b0816",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "RMSE: 0.4993\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "0.4992596085741228"
      ]
     },
     "execution_count": 417,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "rmse(predictions)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "65e3d046-f24d-4adb-8a91-8d90c18e4b94",
   "metadata": {},
   "source": [
    "- using RMSE to evaluate the models and the RMSE seems good around 0.4993"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 418,
   "id": "80bd5e5e-1945-4f81-8fe5-9d2d65c189c2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['KNN_Model.joblib']"
      ]
     },
     "execution_count": 418,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "joblib.dump(algo, \"KNN_Model.joblib\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3fbf727c-ebd9-4476-afbc-f5a7c5a14aaa",
   "metadata": {},
   "source": [
    "- save model "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8b5c8a49-fce3-42a3-a342-7d3ef3df3954",
   "metadata": {},
   "source": [
    "### testing"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 420,
   "id": "b390e5a6-01ae-46c4-8df0-493f75fe2b02",
   "metadata": {},
   "outputs": [],
   "source": [
    "list_predicted = []\n",
    "\n",
    "for id in df_ph_final['product_id'].unique():\n",
    "    preds = list(algo.predict(1, id))\n",
    "    product_id = preds[1]\n",
    "    product_score = preds[3]\n",
    "\n",
    "    list_predicted.append((product_id, product_score))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 425,
   "id": "423ab39c-9232-4ca5-a395-1d5366e6096b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([101, 105, 120, 110, 102, 115, 103, 103, 122, 114, 114, 124, 121])"
      ]
     },
     "execution_count": 425,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_ph_final[df_ph_final['customer_id']==1]['product_id'].values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 430,
   "id": "c3e97249-37b0-4f43-9849-aa30df423169",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[105, 121, 118, 114, 101]"
      ]
     },
     "execution_count": 430,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "top_5_products = sorted(list_predicted, key=lambda x:x[1], reverse=True)[:5]\n",
    "top_5_products = [product[0] for product in top_5_products]\n",
    "top_5_products"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0159ed80-6adc-4238-af18-fc1701da965c",
   "metadata": {},
   "source": [
    "- so from the historical data, the models predict that\n",
    "- the most likely products that the user will buy are 105, 121, 118, 114, 101"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "de0860a0-47ed-432b-ba09-26bd41e85d7c",
   "metadata": {},
   "source": [
    "## Web Apps Development\n",
    "- will use gradio and will hosting to huggingface"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 447,
   "id": "f73f026e-8692-48b6-af28-411439bac649",
   "metadata": {},
   "outputs": [],
   "source": [
    "df_ph_final.to_csv(\"data_final.csv\", index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 437,
   "id": "f9db4891-7e9c-406f-9487-faf2ccd8c1b8",
   "metadata": {},
   "outputs": [],
   "source": [
    "def product_recommender(customer_id):\n",
    "    list_predicted = []\n",
    "    \n",
    "    for id in df_ph_final['product_id'].unique():\n",
    "        preds = list(algo.predict(customer_id, id))\n",
    "        product_id = preds[1]\n",
    "        product_score = preds[3]\n",
    "    \n",
    "        list_predicted.append((product_id, product_score))\n",
    "        \n",
    "    top_5_products_raw = sorted(list_predicted, key=lambda x:x[1], reverse=True)[:5]\n",
    "    top_5_products = [product[0] for product in top_5_products_raw]\n",
    "\n",
    "    product_1_category = df_ph_final[df_ph_final['product_id']==top_5_products[0]]['category'].values[0]\n",
    "    product_2_category = df_ph_final[df_ph_final['product_id']==top_5_products[1]]['category'].values[0]\n",
    "    product_3_category = df_ph_final[df_ph_final['product_id']==top_5_products[2]]['category'].values[0]\n",
    "    product_4_category = df_ph_final[df_ph_final['product_id']==top_5_products[3]]['category'].values[0]\n",
    "    product_5_category = df_ph_final[df_ph_final['product_id']==top_5_products[4]]['category'].values[0]\n",
    "\n",
    "    result_1 = f\"Recommendation Product ID {top_5_products[0]} with Category {product_1_category}\"\n",
    "    result_2 = f\"Recommendation Product ID {top_5_products[1]} with Category {product_2_category}\"\n",
    "    result_3 = f\"Recommendation Product ID {top_5_products[2]} with Category {product_3_category}\"\n",
    "    result_4 = f\"Recommendation Product ID {top_5_products[3]} with Category {product_4_category}\"\n",
    "    result_5 = f\"Recommendation Product ID {top_5_products[4]} with Category {product_5_category}\"\n",
    "\n",
    "    return result_1, result_2, result_3, result_4, result_5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 442,
   "id": "1ea72b31-8ca8-46f1-9833-d33cb4cc8ae7",
   "metadata": {},
   "outputs": [],
   "source": [
    "demo = gr.Interface(\n",
    "    title=\"Product Recommendation System\",\n",
    "    description=\"\"\"This User Interface is Powered by Machine Learning to\n",
    "                Predict the Top 5 of Product that customer likely to buy in the next purchase.\n",
    "                All you need is to Input Customer ID and then the Recommendation will be appear.\"\"\",\n",
    "    fn=product_recommender,\n",
    "    inputs=[\n",
    "        gr.Number(label=\"Input Customer ID\")\n",
    "    ],\n",
    "    outputs=[\n",
    "        gr.Textbox(label=\"Recommendation Product 1\"),\n",
    "        gr.Textbox(label=\"Recommendation Product 2\"),\n",
    "        gr.Textbox(label=\"Recommendation Product 3\"),\n",
    "        gr.Textbox(label=\"Recommendation Product 4\"),\n",
    "        gr.Textbox(label=\"Recommendation Product 5\")\n",
    "    ]\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 443,
   "id": "3d5921b0-816f-4d59-acc2-63e0be081f9f",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Running on local URL:  http://127.0.0.1:7862\n",
      "\n",
      "To create a public link, set `share=True` in `launch()`.\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div><iframe src=\"http://127.0.0.1:7862/\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": []
     },
     "execution_count": 443,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "demo.launch()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "192d7c24-be73-48a7-8bc0-eb1bc49d3e54",
   "metadata": {},
   "source": [
    "## Scripts for Deployment in Huggingface"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 445,
   "id": "3d4df15e-88f4-4854-bc2c-8267211cd6eb",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Writing requirements.txt\n"
     ]
    }
   ],
   "source": [
    "%%writefile requirements.txt\n",
    "gradio\n",
    "pandas\n",
    "numpy\n",
    "faker\n",
    "scikit-surprise"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 449,
   "id": "408aac2a-9b5c-4797-bd00-7706007f81c1",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Writing app.py\n"
     ]
    }
   ],
   "source": [
    "%%writefile app.py\n",
    "import gradio as gr\n",
    "import pandas as pd\n",
    "import joblib\n",
    "\n",
    "data = pd.read_csv(r\"data_final.csv\")\n",
    "\n",
    "def product_recommender(customer_id):\n",
    "    list_predicted = []\n",
    "    \n",
    "    for id in data['product_id'].unique():\n",
    "        preds = list(algo.predict(customer_id, id))\n",
    "        product_id = preds[1]\n",
    "        product_score = preds[3]\n",
    "    \n",
    "        list_predicted.append((product_id, product_score))\n",
    "        \n",
    "    top_5_products_raw = sorted(list_predicted, key=lambda x:x[1], reverse=True)[:5]\n",
    "    top_5_products = [product[0] for product in top_5_products_raw]\n",
    "\n",
    "    product_1_category = data[data['product_id']==top_5_products[0]]['category'].values[0]\n",
    "    product_2_category = data[data['product_id']==top_5_products[1]]['category'].values[0]\n",
    "    product_3_category = data[data['product_id']==top_5_products[2]]['category'].values[0]\n",
    "    product_4_category = data[data['product_id']==top_5_products[3]]['category'].values[0]\n",
    "    product_5_category = data[data['product_id']==top_5_products[4]]['category'].values[0]\n",
    "\n",
    "    result_1 = f\"Recommendation Product ID {top_5_products[0]} with Category {product_1_category}\"\n",
    "    result_2 = f\"Recommendation Product ID {top_5_products[1]} with Category {product_2_category}\"\n",
    "    result_3 = f\"Recommendation Product ID {top_5_products[2]} with Category {product_3_category}\"\n",
    "    result_4 = f\"Recommendation Product ID {top_5_products[3]} with Category {product_4_category}\"\n",
    "    result_5 = f\"Recommendation Product ID {top_5_products[4]} with Category {product_5_category}\"\n",
    "\n",
    "    return result_1, result_2, result_3, result_4, result_5\n",
    "\n",
    "demo = gr.Interface(\n",
    "    title=\"Product Recommendation System\",\n",
    "    description=\"\"\"This User Interface is Powered by Machine Learning to\n",
    "                Predict the Top 5 of Product that customer likely to buy in the next purchase.\n",
    "                All you need is to Input Customer ID and then the Recommendation will be appear.\"\"\",\n",
    "    fn=product_recommender,\n",
    "    inputs=[\n",
    "        gr.Number(label=\"Input Customer ID\")\n",
    "    ],\n",
    "    outputs=[\n",
    "        gr.Textbox(label=\"Recommendation Product 1\"),\n",
    "        gr.Textbox(label=\"Recommendation Product 2\"),\n",
    "        gr.Textbox(label=\"Recommendation Product 3\"),\n",
    "        gr.Textbox(label=\"Recommendation Product 4\"),\n",
    "        gr.Textbox(label=\"Recommendation Product 5\")\n",
    "    ]\n",
    ")\n",
    "\n",
    "if __name__ == \"__main__\":\n",
    "    demo.launch()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "50dee250-e65d-4ae3-9263-cfacc09ac6ff",
   "metadata": {},
   "source": [
    "- link web apps --> https://huggingface.co/spaces/Adipta/product-recommender\n",
    "- link repository --> https://huggingface.co/spaces/Adipta/product-recommender/tree/main"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "61ac0db1-1c8e-447f-8cb2-70f679d61a59",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "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.8.18"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}