{ "cells": [ { "cell_type": "markdown", "id": "34001c4b-fd7b-49a9-8389-35c0c6d6ffba", "metadata": {}, "source": [ "## Temporal Plots\n", "Temporal Mapper constructs a graph which does not have an inherent visualization. Moreover, if your data has $d$ semantic dimensions, then the graph 'naturally' lives in $d+1$ dimensions when including time.\n", "\n", "A temporal plot of a `TemporalMapper` is a 2d plot where the $x$-axis of a vertex is the median time of its corresponding cluster. For the $y$-axis, you can either pass a 1d reduction of your data or you can use an optimization algorithm to minimize the number of edge crossings. " ] }, { "cell_type": "markdown", "id": "1bead087-1e56-4d8f-9221-d496f6f26c83", "metadata": {}, "source": [ "Let's demonstrate a Temporal Plot by fitting a `TemporalMapper` to a small dataset of 10,000 arXiv machine learning papers. The paper's titles and abstracts were concatenated and embedded using the sentence transformer [all-mpnet-base-v2](https://huggingface.co/sentence-transformers/all-mpnet-base-v2), and then reduced to 2D with UMAP." ] }, { "cell_type": "code", "execution_count": 1, "id": "52fe5ea8-32bd-4750-997c-90e7a32adc57", "metadata": { "execution": { "iopub.execute_input": "2026-03-10T13:17:03.460412Z", "iopub.status.busy": "2026-03-10T13:17:03.460287Z", "iopub.status.idle": "2026-03-10T13:17:43.806930Z", "shell.execute_reply": "2026-03-10T13:17:43.806118Z", "shell.execute_reply.started": "2026-03-10T13:17:03.460397Z" } }, "outputs": [], "source": [ "import temporalmapper as tm\n", "import numpy as np\n", "import pandas as pd\n", "import matplotlib.pyplot as plt\n", "import requests, io\n", "from fast_hdbscan import HDBSCAN" ] }, { "cell_type": "code", "execution_count": 2, "id": "cc6ea0fb-62a7-434d-baf7-c3e97e5adffd", "metadata": { "execution": { "iopub.execute_input": "2026-03-10T13:17:43.808105Z", "iopub.status.busy": "2026-03-10T13:17:43.807679Z", "iopub.status.idle": "2026-03-10T13:17:44.793551Z", "shell.execute_reply": "2026-03-10T13:17:44.792835Z", "shell.execute_reply.started": "2026-03-10T13:17:43.808087Z" } }, "outputs": [ { "data": { "text/html": [ "
| \n", " | title | \n", "abstract | \n", "id | \n", "created | \n", "authors | \n", "arxiv | \n", "doi | \n", "
|---|---|---|---|---|---|---|---|
| 0 | \n", "automated rating of recorded classroom present... | \n", "effective presentation skills can help to succ... | \n", "1801.00453 | \n", "2018-01-01 | \n", "[akzharkyn izbassarova, aidana irmanova, a. p.... | \n", "cs.ai | \n", "10.1109/icacci.2017.8125872 | \n", "
| 1 | \n", "accelerating deep learning with memcomputing | \n", "restricted boltzmann machines (rbms) and their... | \n", "1801.00512 | \n", "2018-01-01 | \n", "[haik manukian, fabio l. traversa, massimilian... | \n", "cs.ai | \n", "\n", " |
| 2 | \n", "accelerating deep learning with memcomputing | \n", "restricted boltzmann machines (rbms) and their... | \n", "1801.00512 | \n", "2018-01-01 | \n", "[haik manukian, fabio l. traversa, massimilian... | \n", "cs.lg | \n", "\n", " |
| 3 | \n", "accurate reconstruction of image stimuli from ... | \n", "in neuroscience, all kinds of computation mode... | \n", "1801.00602 | \n", "2018-01-02 | \n", "[kai qiao, chi zhang, linyuan wang, bin yan, j... | \n", "cs.ai | \n", "\n", " |
| 4 | \n", "deep learning: a critical appraisal | \n", "although deep learning has historical roots go... | \n", "1801.00631 | \n", "2018-01-02 | \n", "[gary marcus] | \n", "cs.lg | \n", "\n", " |
TemporalMapper(clusterer=HDBSCAN(min_cluster_size=15),\n",
" data=array([[ 4.82239962, -1.57145286],\n",
" [ 1.20892036, -3.84591722],\n",
" [ 1.20193553, -3.85584664],\n",
" ...,\n",
" [11.05540466, 10.08293819],\n",
" [ 8.87438393, -1.76646364],\n",
" [11.04866219, 10.09112167]], shape=(10000, 2)),\n",
" n_slices=8, slice_method='data',\n",
" time=array([ 0., 0., 0., ..., 480., 480., 480.], shape=(10000,)))In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. | \n", " | time | \n", "array([ 0., ...hape=(10000,)) | \n", "
| \n", " | data | \n", "array([[ 4.82...pe=(10000, 2)) | \n", "
| \n", " | clusterer | \n", "HDBSCAN(min_cluster_size=15) | \n", "
| \n", " | n_slices | \n", "8 | \n", "
| \n", " | n_neighbors | \n", "5 | \n", "
| \n", " | overlap | \n", "0.5 | \n", "
| \n", " | inclusion_threshold | \n", "0.01 | \n", "
| \n", " | slice_method | \n", "'data' | \n", "
| \n", " | density_based | \n", "True | \n", "
| \n", " | kernel | \n", "<function squ...x70f2f4e7a5c0> | \n", "
| \n", " | kernel_params | \n", "None | \n", "
| \n", " | verbose | \n", "False | \n", "
HDBSCAN(min_cluster_size=15)
| \n", " | min_cluster_size | \n", "15 | \n", "
| \n", " | min_samples | \n", "None | \n", "
| \n", " | cluster_selection_method | \n", "'eom' | \n", "
| \n", " | allow_single_cluster | \n", "False | \n", "
| \n", " | max_cluster_size | \n", "inf | \n", "
| \n", " | cluster_selection_epsilon | \n", "0.0 | \n", "
| \n", " | cluster_selection_persistence | \n", "0.0 | \n", "
| \n", " | semi_supervised | \n", "False | \n", "
| \n", " | ss_algorithm | \n", "'bc' | \n", "