{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "initial_id",
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "%load_ext autoreload\n",
    "%autoreload 2\n",
    "%env CUDA_VISIBLE_DEVICES=1\n",
    "from utils.utils import get_path, measure_run_time\n",
    "import os"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "root_path = get_path(\"data\")\n",
    "fig_path = os.path.join(root_path, \"figures\")\n",
    "seeds = [0, 1, 2]"
   ],
   "metadata": {
    "collapsed": false
   },
   "id": "ad17a0efdb0b831c"
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "dist_times, ph_times = measure_run_time(dataset=\"toy_circle\",\n",
    "                                        distance=\"euclidean\",\n",
    "                                        dist_kwargs={},\n",
    "                                        embd_dim=50,\n",
    "                                        n=1000,\n",
    "                                        seeds=seeds,\n",
    "                                        feature_dim=1,\n",
    "                                        root_path=root_path,\n",
    "                                        sigma=0.0,\n",
    "                                        force_recompute=False)\n",
    "print(\"Run time on circle for euclidean distance, 1D features, and n=1000 points\")\n",
    "print(f\"Time for distances: {dist_times.mean()} +/- {dist_times.std()} s\")\n",
    "print(f\"Time for PD       : {ph_times.mean()} +/- {ph_times.std()} s\")"
   ],
   "metadata": {
    "collapsed": false
   },
   "id": "a0e1b4ecccb07c72"
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "dist_times, ph_times = measure_run_time(dataset=\"toy_circle\",\n",
    "                                        distance=\"eff_res\",\n",
    "                                        dist_kwargs={\"corrected\": True, \"weighted\": False, \"k\": 100, \"disconnect\": True},\n",
    "                                        embd_dim=50,\n",
    "                                        n=1000,\n",
    "                                        seeds=seeds,\n",
    "                                        feature_dim=1,\n",
    "                                        root_path=root_path,\n",
    "                                        sigma=0.0,\n",
    "                                        force_recompute=False)\n",
    "print(\"Run time on circle for effective resistance, 1D features, and n=1000 points\")\n",
    "print(f\"Time for distances: {dist_times.mean()} +/- {dist_times.std()} s\")\n",
    "print(f\"Time for PD       : {ph_times.mean()} +/- {ph_times.std()} s\")"
   ],
   "metadata": {
    "collapsed": false
   },
   "id": "a27c8f38efa47193"
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "dist_times, ph_times = measure_run_time(dataset=\"toy_circle\",\n",
    "                                        distance=\"euclidean\",\n",
    "                                        dist_kwargs={},\n",
    "                                        embd_dim=50,\n",
    "                                        n=2000,\n",
    "                                        seeds=seeds,\n",
    "                                        feature_dim=1,\n",
    "                                        sigma=0.0,\n",
    "                                        root_path=root_path,\n",
    "                                        force_recompute=False)\n",
    "print(\"Run time on circle for euclidean distance, 1D features, and n=2000 points\")\n",
    "print(f\"Time for distances: {dist_times.mean()} +/- {dist_times.std()} s\")\n",
    "print(f\"Time for PD       : {ph_times.mean()} +/- {ph_times.std()} s\")"
   ],
   "metadata": {
    "collapsed": false
   },
   "id": "9cd888e5ac9f2083"
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "dist_times, ph_times = measure_run_time(dataset=\"toy_sphere\",\n",
    "                                        distance=\"euclidean\",\n",
    "                                        dist_kwargs={},\n",
    "                                        embd_dim=50,\n",
    "                                        n=1000,\n",
    "                                        seeds=seeds,\n",
    "                                        feature_dim=1,\n",
    "                                        sigma=0.0,\n",
    "                                        root_path=root_path,\n",
    "                                        force_recompute=False)\n",
    "print(\"Run time on sphere for euclidean distance, 1D features, and n=1000 points\")\n",
    "print(f\"Time for distances: {dist_times.mean()} +/- {dist_times.std()} s\")\n",
    "print(f\"Time for PD       : {ph_times.mean()} +/- {ph_times.std()} s\")"
   ],
   "metadata": {
    "collapsed": false
   },
   "id": "15c942c951d51d45"
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "dist_times, ph_times = measure_run_time(dataset=\"toy_sphere\",\n",
    "                                        distance=\"euclidean\",\n",
    "                                        dist_kwargs={},\n",
    "                                        embd_dim=50,\n",
    "                                        n=1000,\n",
    "                                        seeds=seeds,\n",
    "                                        feature_dim=2,\n",
    "                                        sigma=0.0,\n",
    "                                        root_path=root_path,\n",
    "                                        force_recompute=False)\n",
    "print(\"Run time on sphere for euclidean distance, 2D features, and n=1000 points\")\n",
    "print(f\"Time for distances: {dist_times.mean()} +/- {dist_times.std()} s\")\n",
    "print(f\"Time for PD       : {ph_times.mean()} +/- {ph_times.std()} s\")"
   ],
   "metadata": {
    "collapsed": false
   },
   "id": "53dc1e7dfcfa895b"
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false
   },
   "id": "4998dd6be66d9341"
  }
 ],
 "metadata": {
  "kernelspec": {
   "name": "conda-env-ph-py",
   "language": "python",
   "display_name": "Python [conda env:ph]"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
