{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "df_30b_v0.shape: (241818, 63)\n"
     ]
    }
   ],
   "source": [
    "df_30b_v0 = pd.read_csv(\n",
    "    \"/home/tony/Data/Preference/30b_v0/interesting_clips_v4_t_1_20240808.csv\"\n",
    ")\n",
    "print(f\"df_30b_v0.shape: {df_30b_v0.shape}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "df_30b_v1.shape: (224104, 65)\n"
     ]
    }
   ],
   "source": [
    "df_30b_v1 = pd.read_pickle(\n",
    "    \"/home/tony/Data/Preference/30b_v1/interesting_clips_v4_t_2_20240830_full.pkl\"\n",
    ")\n",
    "print(f\"df_30b_v1.shape: {df_30b_v1.shape}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "df_30b_v2.shape: (274812, 68)\n"
     ]
    }
   ],
   "source": [
    "df_30b_v2 = pd.read_pickle(\n",
    "    \"/home/tony/Data/Preference/30b_v2/interesting_clips_v4_t_3_20240919_full.pkl\"\n",
    ")\n",
    "print(f\"df_30b_v2.shape: {df_30b_v2.shape}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "df_30b_v3.shape: (256814, 67)\n"
     ]
    }
   ],
   "source": [
    "df_30b_v3 = pd.read_pickle(\n",
    "    \"/home/tony/Data/Preference/30b_v3/interesting_clips_v4_t_4_20241007_full.pkl\"\n",
    ")\n",
    "print(f\"df_30b_v3.shape: {df_30b_v3.shape}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "df_30b_v5.shape: (376140, 68)\n"
     ]
    }
   ],
   "source": [
    "df_30b_v5 = pd.read_pickle(\n",
    "    \"/home/tony/Data/Preference/30b_v5/interesting_clips_v4_t_5_20241030_full.pkl\"\n",
    ")\n",
    "print(f\"df_30b_v5.shape: {df_30b_v5.shape}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "user_30b_v0.shape: 89152\n",
      "user_30b_v1.shape: 80809\n",
      "user_30b_v2.shape: 66219\n",
      "user_30b_v3.shape: 30560\n",
      "user_30b_v5.shape: 56566\n"
     ]
    }
   ],
   "source": [
    "user_30b_v0 = df_30b_v0[\"user_id\"].unique()\n",
    "user_30b_v1 = df_30b_v1[\"user_id\"].unique()\n",
    "user_30b_v2 = df_30b_v2[\"user_id\"].unique()\n",
    "user_30b_v3 = df_30b_v3[\"user_id\"].unique()\n",
    "user_30b_v5 = df_30b_v5[\"user_id\"].unique()\n",
    "\n",
    "print(f\"user_30b_v0.shape: {len(user_30b_v0)}\")\n",
    "print(f\"user_30b_v1.shape: {len(user_30b_v1)}\")\n",
    "print(f\"user_30b_v2.shape: {len(user_30b_v2)}\")\n",
    "print(f\"user_30b_v3.shape: {len(user_30b_v3)}\")\n",
    "print(f\"user_30b_v5.shape: {len(user_30b_v5)}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "unique_30b_users.shape: 2054\n"
     ]
    }
   ],
   "source": [
    "unique_30b_users = (\n",
    "    set(user_30b_v0)\n",
    "    .intersection(set(user_30b_v1))\n",
    "    .intersection(set(user_30b_v2))\n",
    "    .intersection(set(user_30b_v3))\n",
    "    .intersection(set(user_30b_v5))\n",
    ")\n",
    "print(f\"unique_30b_users.shape: {len(unique_30b_users)}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "df_13b_special_29.shape: (477514, 71)\n",
      "df_13b_special_31.shape: (163440, 68)\n",
      "unique_13b_special_users.shape: 10731\n"
     ]
    }
   ],
   "source": [
    "df_13b_special_29 = pd.read_pickle(\n",
    "    \"/home/tony/Data/Preference/30b_v2/interesting_clips_13b_s8_20240925_full_l10.pkl\"\n",
    ")\n",
    "print(f\"df_13b_special_29.shape: {df_13b_special_29.shape}\")\n",
    "\n",
    "df_13b_special_31 = pd.read_pickle(\n",
    "    \"/home/tony/Data/Preference/13b_v1/interesting_clips_13b_s8_v29_20241029_full.pkl\"\n",
    ")\n",
    "print(f\"df_13b_special_31.shape: {df_13b_special_31.shape}\")\n",
    "\n",
    "user_13b_special_29 = df_13b_special_29[\"user_id\"].unique()\n",
    "user_13b_special_31 = df_13b_special_31[\"user_id\"].unique()\n",
    "\n",
    "unique_13b_special_users = set(user_13b_special_29).intersection(\n",
    "    set(user_13b_special_31)\n",
    ")\n",
    "print(f\"unique_13b_special_users.shape: {len(unique_13b_special_users)}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "unique_golden_users.shape: 665\n"
     ]
    }
   ],
   "source": [
    "unique_golden_users = set(unique_30b_users).intersection(unique_13b_special_users)\n",
    "print(f\"unique_golden_users.shape: {len(unique_golden_users)}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "alpha_users: 665\n",
      "alpha_2nd_users: 1389\n"
     ]
    }
   ],
   "source": [
    "# best users:\n",
    "alpha_users = sorted(list(unique_golden_users))\n",
    "alpha_2nd_users = sorted(list(unique_30b_users.difference(unique_golden_users)))\n",
    "\n",
    "print(f\"alpha_users: {len(alpha_users)}\")\n",
    "print(f\"alpha_2nd_users: {len(alpha_2nd_users)}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "pd.Series(alpha_users).to_csv(\"/home/tony/Data/Preference/alpha_users/alpha_users_20241111.csv\", index=False)\n",
    "pd.Series(alpha_2nd_users).to_csv(\"/home/tony/Data/Preference/alpha_users/alpha_2nd_users_20241111.csv\", index=False)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "suno_env",
   "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.10.14"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
