You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by jb...@apache.org on 2018/10/31 12:59:58 UTC
lucene-solr:branch_7x: SOLR-12913: Add recip and expand percentile
docs
Repository: lucene-solr
Updated Branches:
refs/heads/branch_7x e8503da7c -> 487e5befa
SOLR-12913: Add recip and expand percentile docs
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/487e5bef
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/487e5bef
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/487e5bef
Branch: refs/heads/branch_7x
Commit: 487e5befab5e48cdbdcb0618f6188c2fe4c44c0a
Parents: e8503da
Author: Joel Bernstein <jb...@apache.org>
Authored: Wed Oct 31 08:48:04 2018 -0400
Committer: Joel Bernstein <jb...@apache.org>
Committed: Wed Oct 31 08:59:43 2018 -0400
----------------------------------------------------------------------
solr/solr-ref-guide/src/scalar-math.adoc | 4 +-
solr/solr-ref-guide/src/statistics.adoc | 81 ++++++++++++++++++++++++++-
2 files changed, 81 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/487e5bef/solr/solr-ref-guide/src/scalar-math.adoc
----------------------------------------------------------------------
diff --git a/solr/solr-ref-guide/src/scalar-math.adoc b/solr/solr-ref-guide/src/scalar-math.adoc
index b602279..f5fa745 100644
--- a/solr/solr-ref-guide/src/scalar-math.adoc
+++ b/solr/solr-ref-guide/src/scalar-math.adoc
@@ -130,8 +130,8 @@ When this expression is sent to the `/stream` handler it responds with:
The following scalar math functions are available in the math expressions library:
-`abs`, `add`, `div`, `mult`, `sub`, `log`,
+`abs`, `add`, `div`, `mult`, `sub`, `log`, `log10`,
`pow`, `mod`, `ceil`, `floor`, `sin`, `asin`,
`sinh`, `cos`, `acos`, `cosh`, `tan`, `atan`,
-`tanh`, `round`, `precision`, `sqrt`, `cbrt`
+`tanh`, `round`, `precision`, `recip`, `sqrt`, `cbrt`
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/487e5bef/solr/solr-ref-guide/src/statistics.adoc
----------------------------------------------------------------------
diff --git a/solr/solr-ref-guide/src/statistics.adoc b/solr/solr-ref-guide/src/statistics.adoc
index 324a8a6..48b81ed 100644
--- a/solr/solr-ref-guide/src/statistics.adoc
+++ b/solr/solr-ref-guide/src/statistics.adoc
@@ -321,6 +321,41 @@ When this expression is sent to the `/stream` handler it responds with:
}
----
+The `percentile` function also operates on an array of percentile values.
+The example below is computing the 20th, 40th, 60th and 80th percentiles for a random sample
+of the *response_d* field:
+
+[source,text]
+----
+let(a=random(collection2, q="*:*", rows="15000", fl="response_d"),
+ b=col(a, response_d),
+ c=percentile(b, array(20,40,60,80)))
+----
+
+When this expression is sent to the `/stream` handler it responds with:
+
+[source,json]
+----
+{
+ "result-set": {
+ "docs": [
+ {
+ "c": [
+ 818.0835543394625,
+ 843.5590348165282,
+ 866.1789509894824,
+ 892.5033386599067
+ ]
+ },
+ {
+ "EOF": true,
+ "RESPONSE_TIME": 291
+ }
+ ]
+ }
+}
+----
+
== Covariance and Correlation
Covariance and Correlation measure how random variables move
@@ -543,6 +578,8 @@ array.
* `cbrt`: Returns a numeric array with the cube root of each element of the original array.
+* `recip`: Returns a numeric array with the reciprocal of each element of the original array.
+
Below is an example of a ttest performed on log transformed data sets:
[source,text]
@@ -661,6 +698,47 @@ When this expression is sent to the `/stream` handler it responds with:
}
----
+Vectors that have been transformed with the `recip` function can be back-transformed by taking the reciprocal
+of the reciprocal.
+
+The example below shows an example of the back-transformation of the `recip` function.
+
+[source,text]
+----
+let(echo="b,c",
+ a=array(100, 200, 300),
+ b=recip(a),
+ c=recip(b))
+----
+
+When this expression is sent to the `/stream` handler it responds with:
+
+[source,json]
+----
+{
+ "result-set": {
+ "docs": [
+ {
+ "b": [
+ 0.01,
+ 0.005,
+ 0.0033333333333333335
+ ],
+ "c": [
+ 100,
+ 200,
+ 300
+ ]
+ },
+ {
+ "EOF": true,
+ "RESPONSE_TIME": 0
+ }
+ ]
+ }
+}
+----
+
== Z-scores
The `zscores` function converts a numeric array to an array of z-scores. The z-score
@@ -696,5 +774,4 @@ When this expression is sent to the `/stream` handler it responds with:
]
}
}
-----
-
+----
\ No newline at end of file