diff --git "a/paperswithcode_api.ipynb" "b/paperswithcode_api.ipynb" --- "a/paperswithcode_api.ipynb" +++ "b/paperswithcode_api.ipynb" @@ -26,9 +26,9 @@ " @numba.jit()\n", "/mnt/nvme01/.venv/lib/python3.11/site-packages/umap/umap_.py:660: NumbaDeprecationWarning: The 'nopython' keyword argument was not supplied to the 'numba.jit' decorator. The implicit default value for this argument is currently False, but it will be changed to True in Numba 0.59.0. See https://numba.readthedocs.io/en/stable/reference/deprecation.html#deprecation-of-object-mode-fall-back-behaviour-when-using-jit for details.\n", " @numba.jit()\n", - "2023-07-14 13:12:02.877303: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.\n", + "2023-07-31 14:09:33.776661: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.\n", "To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.\n", - "2023-07-14 13:12:03.877543: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT\n" + "2023-07-31 14:09:34.665770: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT\n" ] } ], @@ -40,7 +40,8 @@ "import uuid\n", "from sentence_transformers import SentenceTransformer\n", "from umap import UMAP\n", - "from sklearn.model_selection import train_test_split" + "from sklearn.model_selection import train_test_split\n", + "import plotly.express as px" ] }, { @@ -86,7 +87,7 @@ "print(\"Done.\")\n", "\n", "# Write areas to json file\n", - "areas.to_json(\"areas.json\", orient=\"records\")\n", + "areas.to_json(\"json_files/areas.json\", orient=\"records\")\n", "\n", "print(f\"Saved {len(areas)} areas with corresponding tasks to areas.json.\")" ] @@ -100,7 +101,7 @@ "# RUN ONLY IF YOU DONT HAVE THE CORRESPONDING JSON FILES AT HAND - it takes around 2 hours to run\n", "\n", "# Get areas.json\n", - "areas = pd.read_json(\"areas.json\", orient=\"records\")\n", + "areas = pd.read_json(\"json_files/areas.json\", orient=\"records\")\n", "\n", "# Get all papers from all tasks and write them to the dataframe\n", "print(\"Getting all papers...\")\n", @@ -128,7 +129,7 @@ "print(\"Done.\")\n", "\n", "# Write areas to json file\n", - "areas.to_json(\"areas_tasks_papers.json\", orient=\"records\")\n", + "areas.to_json(\"json_files/areas_tasks_papers.json\", orient=\"records\")\n", "print(f\"Saved {len(areas)} areas with corresponding tasks and papers to areas_tasks_papers.json.\")" ] }, @@ -143,7 +144,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 9, "metadata": {}, "outputs": [ { @@ -153,35 +154,6 @@ "EXPLORING THE DATA\n" ] }, - { - "data": { - "text/html": [ - " \n", - " " - ] - }, - "metadata": {}, - "output_type": "display_data" - }, { "data": { "application/vnd.plotly.v1+json": { @@ -1092,9 +1064,9 @@ } }, "text/html": [ - "
" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "# Load the papers csv into a new dataframe called \"papers_csv\"\n", + "papers_csv = pd.read_csv(\"papers.csv\")\n", + "\n", + "# Sample 1000 papers from the papers csv\n", + "papers_csv_sample = papers_csv.sample(1000)\n", + "\n", + "# Convert the umap_embedding column from a string to a list of two values\n", + "papers_csv_sample[\"umap_embedding\"] = papers_csv_sample[\"umap_embedding\"].apply(lambda x: eval(x))\n", + "\n", + "# Create a interactive plotly scatter plot from the papers csv sample. In the umap_embedding column are the 2D embeddings as a list with two values. The hover data should be title, areaID and taskID.\n", + "fig = px.scatter(papers_csv_sample, x=papers_csv_sample[\"umap_embedding\"].apply(lambda x: x[0]), y=papers_csv_sample[\"umap_embedding\"].apply(lambda x: x[1]), hover_data=[\"title\", \"areaID\", \"taskID\"])\n", + "fig.show()" + ] } ], "metadata": {