You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by jm...@apache.org on 2022/09/24 07:13:22 UTC

[datasketches-cpp] 01/01: update theta jupyter notebook to reflect current API

This is an automated email from the ASF dual-hosted git repository.

jmalkin pushed a commit to branch fix_theta_nb
in repository https://gitbox.apache.org/repos/asf/datasketches-cpp.git

commit 9dd3cf1b8d5866e04250205e52bc7d6830d70018
Author: Jon <jm...@apache.org>
AuthorDate: Sat Sep 24 00:13:00 2022 -0700

    update theta jupyter notebook to reflect current API
---
 python/jupyter/ThetaSketchNotebook.ipynb | 55 ++++++++++++++++++--------------
 1 file changed, 31 insertions(+), 24 deletions(-)

diff --git a/python/jupyter/ThetaSketchNotebook.ipynb b/python/jupyter/ThetaSketchNotebook.ipynb
index e7298bb..7a3e320 100644
--- a/python/jupyter/ThetaSketchNotebook.ipynb
+++ b/python/jupyter/ThetaSketchNotebook.ipynb
@@ -40,20 +40,20 @@
      "name": "stdout",
      "output_type": "stream",
      "text": [
-      "### Update Theta sketch summary:\n",
-      "   lg nominal size      : 12\n",
-      "   lg current size      : 13\n",
-      "   num retained keys    : 6560\n",
-      "   resize factor        : 8\n",
-      "   sampling probability : 1\n",
+      "### Theta sketch summary:\n",
+      "   num retained entries : 6560\n",
       "   seed hash            : 37836\n",
+      "   empty?               : false\n",
       "   ordered?             : false\n",
+      "   estimation mode?     : true\n",
       "   theta (fraction)     : 0.00654224\n",
       "   theta (raw 64-bit)   : 60341508738660257\n",
-      "   estimation mode?     : true\n",
       "   estimate             : 1.00271e+06\n",
       "   lower bound 95% conf : 978261\n",
       "   upper bound 95% conf : 1.02778e+06\n",
+      "   lg nominal size      : 12\n",
+      "   lg current size      : 13\n",
+      "   resize factor        : 8\n",
       "### End sketch summary\n",
       "\n"
      ]
@@ -100,7 +100,7 @@
    "cell_type": "markdown",
    "metadata": {},
    "source": [
-    "We can serialize and reconstruct the sketch. If we compact the sketch prior to serialization, we can still query the rebuilt sketch but cannot update it further."
+    "We can serialize and reconstruct the sketch. Serialization necessarily produces a compact sketch, meaning the sketch can be deserialized and queried or used for further unions or set operations but can not be updated directly."
    ]
   },
   {
@@ -139,7 +139,7 @@
     }
    ],
    "source": [
-    "new_sk1 = theta_sketch.deserialize(sk1_bytes)\n",
+    "new_sk1 = compact_theta_sketch.deserialize(sk1_bytes)\n",
     "print(\"Estimate: \\t\\t\", new_sk1.get_estimate())\n",
     "print(\"Estimation mode: \\t\", new_sk1.is_estimation_mode())"
    ]
@@ -169,20 +169,20 @@
      "name": "stdout",
      "output_type": "stream",
      "text": [
-      "### Update Theta sketch summary:\n",
-      "   lg nominal size      : 13\n",
-      "   lg current size      : 14\n",
-      "   num retained keys    : 12488\n",
-      "   resize factor        : 8\n",
-      "   sampling probability : 1\n",
+      "### Theta sketch summary:\n",
+      "   num retained entries : 12488\n",
       "   seed hash            : 37836\n",
+      "   empty?               : false\n",
       "   ordered?             : false\n",
+      "   estimation mode?     : true\n",
       "   theta (fraction)     : 0.0123336\n",
       "   theta (raw 64-bit)   : 113757656857900725\n",
-      "   estimation mode?     : true\n",
       "   estimate             : 1.01252e+06\n",
       "   lower bound 95% conf : 994626\n",
       "   upper bound 95% conf : 1.03073e+06\n",
+      "   lg nominal size      : 13\n",
+      "   lg current size      : 14\n",
+      "   resize factor        : 8\n",
       "### End sketch summary\n",
       "\n"
      ]
@@ -255,13 +255,14 @@
      "output_type": "stream",
      "text": [
       "Has result:  True\n",
-      "### Compact Theta sketch summary:\n",
-      "   num retained keys    : 1668\n",
+      "### Theta sketch summary:\n",
+      "   num retained entries : 1668\n",
       "   seed hash            : 37836\n",
+      "   empty?               : false\n",
       "   ordered?             : true\n",
+      "   estimation mode?     : true\n",
       "   theta (fraction)     : 0.00654224\n",
       "   theta (raw 64-bit)   : 60341508738660257\n",
-      "   estimation mode?     : true\n",
       "   estimate             : 254959\n",
       "   lower bound 95% conf : 242739\n",
       "   upper bound 95% conf : 267789\n",
@@ -326,13 +327,14 @@
      "name": "stdout",
      "output_type": "stream",
      "text": [
-      "### Compact Theta sketch summary:\n",
-      "   num retained keys    : 4892\n",
+      "### Theta sketch summary:\n",
+      "   num retained entries : 4892\n",
       "   seed hash            : 37836\n",
+      "   empty?               : false\n",
       "   ordered?             : true\n",
+      "   estimation mode?     : true\n",
       "   theta (fraction)     : 0.00654224\n",
       "   theta (raw 64-bit)   : 60341508738660257\n",
-      "   estimation mode?     : true\n",
       "   estimate             : 747756\n",
       "   lower bound 95% conf : 726670\n",
       "   upper bound 95% conf : 769452\n",
@@ -374,7 +376,7 @@
  ],
  "metadata": {
   "kernelspec": {
-   "display_name": "Python 3",
+   "display_name": "Python 3.10.6 64-bit",
    "language": "python",
    "name": "python3"
   },
@@ -388,7 +390,12 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.7.0"
+   "version": "3.10.6"
+  },
+  "vscode": {
+   "interpreter": {
+    "hash": "b0fa6594d8f4cbf19f97940f81e996739fb7646882a419484c72d19e05852a7e"
+   }
   }
  },
  "nbformat": 4,


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org