{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Topic Modeling on product descriptions" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "#py -m pip install bertopic" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "c:\\Users\\LaurèneDAVID\\Documents\\Teaching\\Educational_apps\\app-ai-ds-hec\\venv\\lib\\site-packages\\tqdm\\auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", " from .autonotebook import tqdm as notebook_tqdm\n" ] } ], "source": [ "import os\n", "import pickle\n", "import pandas as pd\n", "from bertopic import BERTopic" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "path_model = r\"C:\\Users\\LaurèneDAVID\\Documents\\Teaching\\Educational_apps\\data-hec-AI-DS\\model_topicmodeling.pkl\"\n", "path_data = r\"C:\\Users\\LaurèneDAVID\\Documents\\Teaching\\Educational_apps\\data-hec-AI-DS\\data-topicmodeling.csv\"" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "ename": "TypeError", "evalue": "_rebuild() got an unexpected keyword argument 'impl_kind'", "output_type": "error", "traceback": [ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", "Cell \u001b[1;32mIn[3], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m model \u001b[38;5;241m=\u001b[39m \u001b[43mpickle\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mload\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mopen\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mpath_model\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mrb\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\n", "File \u001b[1;32mc:\\Users\\LaurèneDAVID\\Documents\\Teaching\\Educational_apps\\app-ai-ds-hec\\venv\\lib\\site-packages\\numba\\core\\serialize.py:152\u001b[0m, in \u001b[0;36mcustom_rebuild\u001b[1;34m(custom_pickled)\u001b[0m\n\u001b[0;32m 147\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"Customized object deserialization.\u001b[39;00m\n\u001b[0;32m 148\u001b[0m \n\u001b[0;32m 149\u001b[0m \u001b[38;5;124;03mThis function is referenced internally by `custom_reduce()`.\u001b[39;00m\n\u001b[0;32m 150\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m 151\u001b[0m \u001b[38;5;28mcls\u001b[39m, states \u001b[38;5;241m=\u001b[39m custom_pickled\u001b[38;5;241m.\u001b[39mctor, custom_pickled\u001b[38;5;241m.\u001b[39mstates\n\u001b[1;32m--> 152\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mcls\u001b[39m\u001b[38;5;241m.\u001b[39m_rebuild(\u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mstates)\n", "\u001b[1;31mTypeError\u001b[0m: _rebuild() got an unexpected keyword argument 'impl_kind'" ] } ], "source": [ "model = pickle.load(open(path_model, 'rb'))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "venv", "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.9.0" } }, "nbformat": 4, "nbformat_minor": 2 }