@@ -135,17 +135,17 @@ General Aggregate Functions
135135 ``combineFunction `` is `commutative <https://en.wikipedia.org/wiki/Commutative_property >`_
136136 and `associative <https://en.wikipedia.org/wiki/Associative_property >`_
137137 operation with ``initialState `` as the
138- `identity <https://en.wikipedia.org/wiki/Identity_element >`_ value.
138+ `identity <https://en.wikipedia.org/wiki/Identity_element >`_ value.::
139139
140- combineFunction(s, initialState) = s for any s
140+ combineFunction(s, initialState) = s for any s
141141
142- combineFunction(s1, s2) = combineFunction(s2, s1) for any s1 and s2
142+ combineFunction(s1, s2) = combineFunction(s2, s1) for any s1 and s2
143143
144- combineFunction(s1, combineFunction(s2, s3)) = combineFunction(combineFunction(s1, s2), s3) for any s1, s2, s3
144+ combineFunction(s1, combineFunction(s2, s3)) = combineFunction(combineFunction(s1, s2), s3) for any s1, s2, s3
145145
146- In addition, make sure that the following holds for the inputFunction:
146+ In addition, make sure that the following holds for the inputFunction::
147147
148- inputFunction(inputFunction(initialState, x), y) = combineFunction(inputFunction(initialState, x), inputFunction(initialState, y)) for any x and y
148+ inputFunction(inputFunction(initialState, x), y) = combineFunction(inputFunction(initialState, x), inputFunction(initialState, y)) for any x and y
149149
150150 ::
151151
@@ -511,62 +511,62 @@ classification thresholds. They are meant to be used in conjunction.
511511
512512For example, to find the `precision-recall curve <https://en.wikipedia.org/wiki/Precision_and_recall >`_, use
513513
514- .. code-block :: none
514+ .. code-block :: none
515515
516- WITH
517- recall_precision AS (
518- SELECT
519- CLASSIFICATION_RECALL(10000, correct, pred) AS recalls,
520- CLASSIFICATION_PRECISION(10000, correct, pred) AS precisions
521- FROM
522- classification_dataset
523- )
524- SELECT
525- recall,
526- precision
527- FROM
528- recall_precision
529- CROSS JOIN UNNEST(recalls, precisions) AS t(recall, precision)
516+ WITH
517+ recall_precision AS (
518+ SELECT
519+ CLASSIFICATION_RECALL(10000, correct, pred) AS recalls,
520+ CLASSIFICATION_PRECISION(10000, correct, pred) AS precisions
521+ FROM
522+ classification_dataset
523+ )
524+ SELECT
525+ recall,
526+ precision
527+ FROM
528+ recall_precision
529+ CROSS JOIN UNNEST(recalls, precisions) AS t(recall, precision)
530530
531531 To get the corresponding thresholds for these values, use
532532
533- .. code-block :: none
533+ .. code-block :: none
534534
535- WITH
536- recall_precision AS (
537- SELECT
538- CLASSIFICATION_THRESHOLDS(10000, correct, pred) AS thresholds,
539- CLASSIFICATION_RECALL(10000, correct, pred) AS recalls,
540- CLASSIFICATION_PRECISION(10000, correct, pred) AS precisions
541- FROM
542- classification_dataset
543- )
544- SELECT
545- threshold,
546- recall,
547- precision
548- FROM
549- recall_precision
550- CROSS JOIN UNNEST(thresholds, recalls, precisions) AS t(threshold, recall, precision)
535+ WITH
536+ recall_precision AS (
537+ SELECT
538+ CLASSIFICATION_THRESHOLDS(10000, correct, pred) AS thresholds,
539+ CLASSIFICATION_RECALL(10000, correct, pred) AS recalls,
540+ CLASSIFICATION_PRECISION(10000, correct, pred) AS precisions
541+ FROM
542+ classification_dataset
543+ )
544+ SELECT
545+ threshold,
546+ recall,
547+ precision
548+ FROM
549+ recall_precision
550+ CROSS JOIN UNNEST(thresholds, recalls, precisions) AS t(threshold, recall, precision)
551551
552552 To find the `ROC curve <https://en.wikipedia.org/wiki/Receiver_operating_characteristic >`_, use
553553
554- .. code-block :: none
554+ .. code-block :: none
555555
556- WITH
557- fallout_recall AS (
558- SELECT
559- CLASSIFICATION_FALLOUT(10000, correct, pred) AS fallouts,
560- CLASSIFICATION_RECALL(10000, correct, pred) AS recalls
561- FROM
562- classification_dataset
563- )
564- SELECT
565- fallout
566- recall,
567- FROM
568- recall_fallout
569- CROSS JOIN UNNEST(fallouts, recalls) AS t(fallout, recall)
556+ WITH
557+ fallout_recall AS (
558+ SELECT
559+ CLASSIFICATION_FALLOUT(10000, correct, pred) AS fallouts,
560+ CLASSIFICATION_RECALL(10000, correct, pred) AS recalls
561+ FROM
562+ classification_dataset
563+ )
564+ SELECT
565+ fallout
566+ recall,
567+ FROM
568+ recall_fallout
569+ CROSS JOIN UNNEST(fallouts, recalls) AS t(fallout, recall)
570570
571571
572572 .. function :: classification_miss_rate(buckets, y, x, weight) -> array<double>
@@ -725,10 +725,10 @@ where :math:`f(x)` is the partial density function of :math:`x`.
725725
726726 .. code-block :: none
727727
728- SELECT
729- differential_entropy(1000000, x)
730- FROM
731- data
728+ SELECT
729+ differential_entropy(1000000, x)
730+ FROM
731+ data
732732
733733 .. note ::
734734
@@ -807,12 +807,12 @@ where :math:`f(x)` is the partial density function of :math:`x`.
807807 To find the differential entropy of ``x ``, each between ``-2.0 `` and ``2.0 ``,
808808 with weights ``weight `` of ``data `` using 1000000 buckets and maximum-likelihood estimates, use
809809
810- .. code-block :: none
810+ .. code-block :: none
811811
812- SELECT
813- differential_entropy(1000000, x, weight, 'fixed_histogram_mle', -2.0, 2.0)
814- FROM
815- data
812+ SELECT
813+ differential_entropy(1000000, x, weight, 'fixed_histogram_mle', -2.0, 2.0)
814+ FROM
815+ data
816816
817817 .. note ::
818818
0 commit comments