From commits-return-104845-archive-asf-public=cust-asf.ponee.io@lucene.apache.org Mon Nov 5 19:56:23 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 7FDF618067E for ; Mon, 5 Nov 2018 19:56:22 +0100 (CET) Received: (qmail 88196 invoked by uid 500); 5 Nov 2018 18:56:20 -0000 Mailing-List: contact commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list commits@lucene.apache.org Received: (qmail 87958 invoked by uid 99); 5 Nov 2018 18:56:20 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Nov 2018 18:56:20 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id BBC8AE1125; Mon, 5 Nov 2018 18:56:19 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ab@apache.org To: commits@lucene.apache.org Date: Mon, 05 Nov 2018 18:56:25 -0000 Message-Id: <108d6cfb8cc3424fb8a542f5fcfb8e45@git.apache.org> In-Reply-To: <75d2c56c263c48059b9bcc3aa57fcf56@git.apache.org> References: <75d2c56c263c48059b9bcc3aa57fcf56@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [07/26] lucene-solr:jira/solr-12730: SOLR-12913: Add recip and expand percentile docs 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/914c4319 Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/914c4319 Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/914c4319 Branch: refs/heads/jira/solr-12730 Commit: 914c4319876421f0b489914614a0b8a60ff85e6d Parents: 856e28d Author: Joel Bernstein Authored: Wed Oct 31 08:48:04 2018 -0400 Committer: Joel Bernstein Committed: Wed Oct 31 08:48:04 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/914c4319/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/914c4319/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