lucene/solr/solr-ref-guide/src/stream-evaluators.adoc

1031 lines
28 KiB
Plaintext
Raw Normal View History

= Stream Evaluator Reference
:page-shortname: stream-evaluators
:page-permalink: stream-evaluators.html
:page-tocclass: right
:page-toclevels: 1
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
Stream evaluators are different then stream sources or stream decorators. Both
stream sources and stream decorators return streams of tuples. Stream evaluators are more like
a traditional function that evaluates its parameters and
returns an result. That result can be a single value, array, map or other structure.
Stream evaluators can be nested so that the output of an evaluator becomes the input
for another evaluator.
Stream evaluators can be called in different contexts. For example a stream evaluator
can be called on its own or it can be called within the context of a streaming expression.
== analyze
2017-06-08 15:18:59 -04:00
The `analyze` function analyzes text using a Lucene/Solr analyzer and returns a list of tokens
emitted by the analyzer. The `analyze` function can be called on its own or within the
`select` and `cartasianProduct` Streaming Expressions.
=== analyze Parameters
* `Field Name` | `Raw Text`: Either the field in a tuple or the raw text to be analyzed.
* `Analyzer Field Name`: The field name of the analyzer to use to analyze the text.
2017-06-08 15:18:59 -04:00
=== analyze Syntax
The expressions below show the various ways in which you can use the `analyze` evaluator.
[source,text]
----
analyze("hello world", analyzerField) // Analyze the raw text
select(expr, analyze(textField, analyzerField) as outField) // Analyze a text field within a select expression. This will annotate the tuples with output of the analyzer
cartesianProduct(expr, analyze(textField, analyzer) as outField) // Analyze a text field with a cartesianProduct expression. This will stream each token emitted by the analyzer in its own tuple.
----
== abs
The `abs` function will return the absolute value of the provided single parameter. The `abs` function will fail to execute if the value is non-numeric. If a null value is found then null will be returned as the result.
=== abs Parameters
* `Field Name | Raw Number | Number Evaluator`
=== abs Syntax
The expressions below show the various ways in which you can use the `abs` evaluator. Only one parameter is accepted. Returns a numeric value.
[source,text]
----
abs(1) // 1, not really a good use case for it
abs(-1) // 1, not really a good use case for it
abs(add(fieldA,fieldB)) // absolute value of fieldA + fieldB
abs(fieldA) // absolute value of fieldA
----
== add
The `add` function will take 2 or more numeric values and add them together. The `add` function will fail to execute if any of the values are non-numeric. If a null value is found then null will be returned as the result.
=== add Parameters
* `Field Name | Raw Number | Number Evaluator`
* `Field Name | Raw Number | Number Evaluator`
* `......`
* `Field Name | Raw Number | Number Evaluator`
=== add Syntax
The expressions below show the various ways in which you can use the `add` evaluator. The number and order of these parameters do not matter and is not limited except that at least two parameters are required. Returns a numeric value.
[source,text]
----
add(1,2,3,4) // 1 + 2 + 3 + 4 == 10
add(1,fieldA) // 1 + value of fieldA
add(fieldA,1.4) // value of fieldA + 1.4
add(fieldA,fieldB,fieldC) // value of fieldA + value of fieldB + value of fieldC
add(fieldA,div(fieldA,fieldB)) // value of fieldA + (value of fieldA / value of fieldB)
add(fieldA,if(gt(fieldA,fieldB),fieldA,fieldB)) // if fieldA > fieldB then fieldA + fieldA, else fieldA + fieldB
----
== div
The `div` function will take two numeric values and divide them. The function will fail to execute if any of the values are non-numeric or null, or the 2nd value is 0. Returns a numeric value.
=== div Parameters
* `Field Name | Raw Number | Number Evaluator`
* `Field Name | Raw Number | Number Evaluator`
=== div Syntax
The expressions below show the various ways in which you can use the `div` evaluator. The first value will be divided by the second and as such the second cannot be 0.
[source,text]
----
div(1,2) // 1 / 2
div(1,fieldA) // 1 / fieldA
div(fieldA,1.4) // fieldA / 1.4
div(fieldA,add(fieldA,fieldB)) // fieldA / (fieldA + fieldB)
----
== log
The `log` function will return the natural log of the provided single parameter. The `log` function will fail to execute if the value is non-numeric. If a null value is found, then null will be returned as the result.
=== log Parameters
* `Field Name | Raw Number | Number Evaluator`
=== log Syntax
The expressions below show the various ways in which you can use the `log` evaluator. Only one parameter is accepted. Returns a numeric value.
[source,text]
----
log(100)
log(add(fieldA,fieldB))
log(fieldA)
----
== mult
The `mult` function will take two or more numeric values and multiply them together. The `mult` function will fail to execute if any of the values are non-numeric. If a null value is found then null will be returned as the result.
=== mult Parameters
* `Field Name | Raw Number | Number Evaluator`
* `Field Name | Raw Number | Number Evaluator`
* `......`
* `Field Name | Raw Number | Number Evaluator`
=== mult Syntax
The expressions below show the various ways in which you can use the `mult` evaluator. The number and order of these parameters do not matter and is not limited except that at least two parameters are required. Returns a numeric value.
[source,text]
----
mult(1,2,3,4) // 1 * 2 * 3 * 4
mult(1,fieldA) // 1 * value of fieldA
mult(fieldA,1.4) // value of fieldA * 1.4
mult(fieldA,fieldB,fieldC) // value of fieldA * value of fieldB * value of fieldC
mult(fieldA,div(fieldA,fieldB)) // value of fieldA * (value of fieldA / value of fieldB)
mult(fieldA,if(gt(fieldA,fieldB),fieldA,fieldB)) // if fieldA > fieldB then fieldA * fieldA, else fieldA * fieldB
----
== sub
The `sub` function will take 2 or more numeric values and subtract them, from left to right. The sub function will fail to execute if any of the values are non-numeric. If a null value is found then null will be returned as the result.
=== sub Parameters
* `Field Name | Raw Number | Number Evaluator`
* `Field Name | Raw Number | Number Evaluator`
* `......`
* `Field Name | Raw Number | Number Evaluator`
=== sub Syntax
The expressions below show the various ways in which you can use the `sub` evaluator. The number of these parameters does not matter and is not limited except that at least two parameters are required. Returns a numeric value.
[source,text]
----
sub(1,2,3,4) // 1 - 2 - 3 - 4
sub(1,fieldA) // 1 - value of fieldA
sub(fieldA,1.4) // value of fieldA - 1.4
sub(fieldA,fieldB,fieldC) // value of fieldA - value of fieldB - value of fieldC
sub(fieldA,div(fieldA,fieldB)) // value of fieldA - (value of fieldA / value of fieldB)
if(gt(fieldA,fieldB),sub(fieldA,fieldB),sub(fieldB,fieldA)) // if fieldA > fieldB then fieldA - fieldB, else fieldB - field
----
== pow
2017-06-16 14:03:13 -04:00
The `pow` function returns the value of its first parameter raised to the power of its second parameter.
=== pow Parameters
* `Field Name | Raw Number | Number Evaluator`: Parameter 1
* `Field Name | Raw Number | Number Evaluator`: Parameter 2
=== pow Syntax
The expressions below show the various ways in which you can use the `pow` evaluator.
[source,text]
----
pow(2,3) // returns 2 raised to the 3rd power.
pow(4,fieldA) // returns 4 raised by the value of fieldA.
pow(fieldA,1.4) // returns the value of fieldA raised by 1.4.
if(gt(fieldA,fieldB),pow(fieldA,fieldB),pow(fieldB,fieldA)) // if fieldA > fieldB then raise fieldA by fieldB, else raise fieldB by fieldA.
----
== mod
2017-06-16 14:18:54 -04:00
The `mod` function returns the remainder (modulo) of the first parameter divided by the second parameter.
=== mod Parameters
* `Field Name | Raw Number | Number Evaluator`: Parameter 1
* `Field Name | Raw Number | Number Evaluator`: Parameter 2
=== mod Syntax
The expressions below show the various ways in which you can use the `mod` evaluator.
[source,text]
----
mod(100,3) // returns the remainder of 100 / 3 .
mod(100,fieldA) // returns the remainder of 100 divided by the value of fieldA.
mod(fieldA,1.4) // returns the remainder of fieldA divided by 1.4.
if(gt(fieldA,fieldB),mod(fieldA,fieldB),mod(fieldB,fieldA)) // if fieldA > fieldB then return the remainder of fieldA/fieldB, else return the remainder of fieldB/fieldA.
2017-06-16 14:29:31 -04:00
----
2017-06-16 14:32:18 -04:00
== ceil
2017-06-16 14:29:31 -04:00
The `ceil` function rounds a decimal value to the next highest whole number.
=== ceil Parameters
* `Field Name | Raw Number | Number Evaluator`: The decimal to round up.
=== ceil Syntax
The expressions below show the various ways in which you can use the `ceil` evaluator.
[source,text]
----
2017-06-16 14:35:12 -04:00
ceil(100.4) // returns 101.
2017-06-16 14:29:31 -04:00
ceil(fieldA) // returns the next highest whole number for fieldA.
if(gt(fieldA,fieldB),ceil(fieldA),ceil(fieldB)) // if fieldA > fieldB then return the ceil of fieldA, else return the ceil of fieldB.
----
== floor
2017-06-16 14:35:12 -04:00
The `floor` function rounds a decimal value to the next lowest whole number.
=== floor Parameters
* `Field Name | Raw Number | Number Evaluator`: The decimal to round down.
=== floor Syntax
The expressions below show the various ways in which you can use the `floor` evaluator.
[source,text]
----
floor(100.4) // returns 100.
ceil(fieldA) // returns the next lowestt whole number for fieldA.
if(gt(fieldA,fieldB),floor(fieldA),floor(fieldB)) // if fieldA > fieldB then return the floor of fieldA, else return the floor of fieldB.
----
== sin
The `sin` function returns the trigonometirc sine of a number.
=== sin Parameters
* `Field Name | Raw Number | Number Evaluator`: The value to return the sine of.
=== sin Syntax
[source,text]
----
sin(100.4) // returns the sine of 100.4
sine(fieldA) // returns the sine for fieldA.
if(gt(fieldA,fieldB),sin(fieldA),sin(fieldB)) // if fieldA > fieldB then return the sine of fieldA, else return the sine of fieldB
----
== asin
The `asin` function returns the trigonometirc arcsine of a number.
=== asin Parameters
* `Field Name | Raw Number | Number Evaluator`: The value to return the arcsine of.
=== asin Syntax
[source,text]
----
asin(100.4) // returns the sine of 100.4
asine(fieldA) // returns the sine for fieldA.
if(gt(fieldA,fieldB),asin(fieldA),asin(fieldB)) // if fieldA > fieldB then return the asine of fieldA, else return the asine of fieldB
----
== hsin
The `hsin` function returns the trigonometirc hyperbolic sine of a number.
=== hsin Parameters
* `Field Name | Raw Number | Number Evaluator`: The value to return the hyperbolic sine of.
=== hsin Syntax
[source,text]
----
hsin(100.4) // returns the hsine of 100.4
hsine(fieldA) // returns the hsine for fieldA.
if(gt(fieldA,fieldB),sin(fieldA),sin(fieldB)) // if fieldA > fieldB then return the hsine of fieldA, else return the hsine of fieldB
----
== cos
The `cos` function returns the trigonometirc cosine of a number.
=== cos Parameters
* `Field Name | Raw Number | Number Evaluator`: The value to return the hyperbolic cosine of.
=== cos Syntax
[source,text]
----
cos(100.4) // returns the arccosine of 100.4
cos(fieldA) // returns the arccosine for fieldA.
if(gt(fieldA,fieldB),cos(fieldA),cos(fieldB)) // if fieldA > fieldB then return the arccosine of fieldA, else return the cosine of fieldB
----
== acos
The `acos` function returns the trigonometirc arccosine of a number.
=== acos Parameters
* `Field Name | Raw Number | Number Evaluator`: The value to return the arccosine of.
=== acos Syntax
[source,text]
----
acos(100.4) // returns the arccosine of 100.4
acos(fieldA) // returns the arccosine for fieldA.
if(gt(fieldA,fieldB),sin(fieldA),sin(fieldB)) // if fieldA > fieldB then return the arccosine of fieldA, else return the arccosine of fieldB
----
== atan
The `atan` function returns the trigonometirc arctangent of a number.
=== atan Parameters
* `Field Name | Raw Number | Number Evaluator`: The value to return the arctangent of.
=== atan Syntax
[source,text]
----
atan(100.4) // returns the arctangent of 100.4
atan(fieldA) // returns the arctangent for fieldA.
if(gt(fieldA,fieldB),atan(fieldA),atan(fieldB)) // if fieldA > fieldB then return the arctanget of fieldA, else return the arctangent of fieldB
----
== round
The `round` function returns the closest whole number to the argument
=== round Parameters
* `Field Name | Raw Number | Number Evaluator`: The value to return the square root of.
=== round Syntax
[source,text]
----
round(100.4)
round(fieldA)
if(gt(fieldA,fieldB),sqrt(fieldA),sqrt(fieldB)) // if fieldA > fieldB then return the round of fieldA, else return the round of fieldB
----
== sqrt
The `sqrt` function returns the trigonometirc square root of a number.
=== sqrt Parameters
* `Field Name | Raw Number | Number Evaluator`: The value to return the square root of.
=== sqrt Syntax
[source,text]
----
sqrt(100.4) // returns the square root of 100.4
sqrt(fieldA) // returns the square root for fieldA.
if(gt(fieldA,fieldB),sqrt(fieldA),sqrt(fieldB)) // if fieldA > fieldB then return the sqrt of fieldA, else return the sqrt of fieldB
----
== cbrt
The `cbrt` function returns the trigonometirc cube root of a number.
=== cbrt Parameters
* `Field Name | Raw Number | Number Evaluator`: The value to return the cube root of.
=== cbrt Syntax
[source,text]
----
cbrt(100.4) // returns the square root of 100.4
cbrt(fieldA) // returns the square root for fieldA.
if(gt(fieldA,fieldB),cbrt(fieldA),cbrt(fieldB)) // if fieldA > fieldB then return the cbrt of fieldA, else return the cbrt of fieldB
----
== and
The `and` function will return the logical AND of at least 2 boolean parameters. The function will fail to execute if any parameters are non-boolean or null. Returns a boolean value.
=== and Parameters
* `Field Name | Raw Boolean | Boolean Evaluator`
* `Field Name | Raw Boolean | Boolean Evaluator`
* `......`
* `Field Name | Raw Boolean | Boolean Evaluator`
=== and Syntax
The expressions below show the various ways in which you can use the `and` evaluator. At least two parameters are required, but there is no limit to how many you can use.
[source,text]
----
and(true,fieldA) // true && fieldA
and(fieldA,fieldB) // fieldA && fieldB
and(or(fieldA,fieldB),fieldC) // (fieldA || fieldB) && fieldC
and(fieldA,fieldB,fieldC,or(fieldD,fieldE),fieldF)
----
== eq
The `eq` function will return whether all the parameters are equal, as per Java's standard `equals(...)` function. The function accepts parameters of any type, but will fail to execute if all the parameters are not of the same type. That is, all are Boolean, all are String, all are Numeric. If any any parameters are null and there is at least one parameter that is not null then false will be returned. Returns a boolean value.
=== eq Parameters
* `Field Name | Raw Value | Evaluator`
* `Field Name | Raw Value | Evaluator`
* `......`
* `Field Name | Raw Value | Evaluator`
=== eq Syntax
The expressions below show the various ways in which you can use the `eq` evaluator.
[source,text]
----
eq(1,2) // 1 == 2
eq(1,fieldA) // 1 == fieldA
eq(fieldA,val(foo)) fieldA == "foo"
eq(add(fieldA,fieldB),6) // fieldA + fieldB == 6
----
== eor
The `eor` function will return the logical exclusive or of at least two boolean parameters. The function will fail to execute if any parameters are non-boolean or null. Returns a boolean value.
=== eor Parameters
* `Field Name | Raw Boolean | Boolean Evaluator`
* `Field Name | Raw Boolean | Boolean Evaluator`
* `......`
* `Field Name | Raw Boolean | Boolean Evaluator`
=== eor Syntax
The expressions below show the various ways in which you can use the `eor` evaluator. At least two parameters are required, but there is no limit to how many you can use.
[source,text]
----
eor(true,fieldA) // true iff fieldA is false
eor(fieldA,fieldB) // true iff either fieldA or fieldB is true but not both
eor(eq(fieldA,fieldB),eq(fieldC,fieldD)) // true iff either fieldA == fieldB or fieldC == fieldD but not both
----
== gteq
The `gteq` function will return whether the first parameter is greater than or equal to the second parameter. The function accepts numeric and string parameters, but will fail to execute if all the parameters are not of the same type. That is, all are String or all are Numeric. If any any parameters are null then an error will be raised. Returns a boolean value.
=== gteq Parameters
* `Field Name | Raw Value | Evaluator`
* `Field Name | Raw Value | Evaluator`
=== gteq Syntax
The expressions below show the various ways in which you can use the `gteq` evaluator.
[source,text]
----
gteq(1,2) // 1 >= 2
gteq(1,fieldA) // 1 >= fieldA
gteq(fieldA,val(foo)) fieldA >= "foo"
gteq(add(fieldA,fieldB),6) // fieldA + fieldB >= 6
----
== gt
The `gt` function will return whether the first parameter is greater than the second parameter. The function accepts numeric or string parameters, but will fail to execute if all the parameters are not of the same type. That is, all are String or all are Numeric. If any any parameters are null then an error will be raised. Returns a boolean value.
=== gt Parameters
* `Field Name | Raw Value | Evaluator`
* `Field Name | Raw Value | Evaluator`
=== gt Syntax
The expressions below show the various ways in which you can use the `gt` evaluator.
[source,text]
----
gt(1,2) // 1 > 2
gt(1,fieldA) // 1 > fieldA
gt(fieldA,val(foo)) // fieldA > "foo"
gt(add(fieldA,fieldB),6) // fieldA + fieldB > 6
----
== if
The `if` function works like a standard conditional if/then statement. If the first parameter is true, then the second parameter will be returned, else the third parameter will be returned. The function accepts a boolean as the first parameter and anything as the second and third parameters. An error will occur if the first parameter is not a boolean or is null.
=== if Parameters
* `Field Name | Raw Value | Boolean Evaluator`
* `Field Name | Raw Value | Evaluator`
* `Field Name | Raw Value | Evaluator`
=== if Syntax
The expressions below show the various ways in which you can use the `if` evaluator.
[source,text]
----
if(fieldA,fieldB,fieldC) // if fieldA is true then fieldB else fieldC
if(gt(fieldA,5), fieldA, 5) // if fieldA > 5 then fieldA else 5
if(eq(fieldB,null), null, div(fieldA,fieldB)) // if fieldB is null then null else fieldA / fieldB
----
== lteq
The `lteq` function will return whether the first parameter is less than or equal to the second parameter. The function accepts numeric and string parameters, but will fail to execute if all the parameters are not of the same type. That is, all are String or all are Numeric. If any any parameters are null then an error will be raised. Returns a boolean value.
=== lteq Parameters
* `Field Name | Raw Value | Evaluator`
* `Field Name | Raw Value | Evaluator`
=== lteq Syntax
The expressions below show the various ways in which you can use the `lteq` evaluator.
[source,text]
----
lteq(1,2) // 1 <= 2
lteq(1,fieldA) // 1 <= fieldA
lteq(fieldA,val(foo)) fieldA <= "foo"
lteq(add(fieldA,fieldB),6) // fieldA + fieldB <= 6
----
== lt
The `lt` function will return whether the first parameter is less than the second parameter. The function accepts numeric or string parameters, but will fail to execute if all the parameters are not of the same type. That is, all are String or all are Numeric. If any any parameters are null then an error will be raised. Returns a boolean value.
=== lt Parameters
* `Field Name | Raw Value | Evaluator`
* `Field Name | Raw Value | Evaluator`
=== lt Syntax
The expressions below show the various ways in which you can use the `lt` evaluator.
[source,text]
----
lt(1,2) // 1 < 2
lt(1,fieldA) // 1 < fieldA
lt(fieldA,val(foo)) fieldA < "foo"
lt(add(fieldA,fieldB),6) // fieldA + fieldB < 6
----
== not
The `not` function will return the logical NOT of a single boolean parameter. The function will fail to execute if the parameter is non-boolean or null. Returns a boolean value.
=== not Parameters
* `Field Name | Raw Boolean | Boolean Evaluator`
=== not Syntax
The expressions below show the various ways in which you can use the `not` evaluator. Only one parameter is allowed.
[source,text]
----
not(true) // false
not(fieldA) // true if fieldA is false else false
not(eq(fieldA,fieldB)) // true if fieldA != fieldB
----
== or
The `or` function will return the logical OR of at least 2 boolean parameters. The function will fail to execute if any parameters are non-boolean or null. Returns a boolean value.
=== or Parameters
* `Field Name | Raw Boolean | Boolean Evaluator`
* `Field Name | Raw Boolean | Boolean Evaluator`
* `......`
* `Field Name | Raw Boolean | Boolean Evaluator`
=== or Syntax
The expressions below show the various ways in which you can use the `or` evaluator. At least two parameters are required, but there is no limit to how many you can use.
[source,text]
----
or(true,fieldA) // true || fieldA
or(fieldA,fieldB) // fieldA || fieldB
or(and(fieldA,fieldB),fieldC) // (fieldA && fieldB) || fieldC
or(fieldA,fieldB,fieldC,and(fieldD,fieldE),fieldF)
----
== raw
The `raw` function will return whatever raw value is the parameter. This is useful for cases where you want to use a string as part of another evaluator.
=== raw Parameters
* `Raw Value`
=== raw Syntax
The expressions below show the various ways in which you can use the `raw` evaluator. Whatever is inside will be returned as-is. Internal evaluators are considered strings and are not evaluated.
[source,text]
----
raw(foo) // "foo"
raw(count(*)) // "count(*)"
raw(45) // 45
raw(true) // "true" (note: this returns the string "true" and not the boolean true)
eq(raw(fieldA), fieldA) // true if the value of fieldA equals the string "fieldA"
----
== movingAvg
The `movingAvg` function calculates a moving average over an array of numbers.
(https://en.wikipedia.org/wiki/Moving_average)
=== movingAvg Parameters
* `numeric array`
* `window size`
=== movingAvg Returns
A numeric array with the moving average. The array returned will be smaller then the
orignal array by the window size.
=== movingAvg Syntax
movingAverage(numericArray, 30)
== anova
The `anova` function calculates the analysis of variance for two or more numeric arrays.
(https://en.wikipedia.org/wiki/Analysis_of_variance)
=== anova Parameters
* `numeric array` ... (two or more)
=== anova Returns
A tuple with the results of ANOVA
=== anova Syntax
anova(numericArray1, numericArray2) // calculats ANOVA for two numeric arrays
anova(numericArray1, numericArray2, numericArray2) // calculats ANOVA for three numeric arrays
== hist
The `hist` function creates a histogram from a numeric array. The hist function is designed
to work with continuous variables.
=== hist Parameters
* `numeric array`
* `bins` (The number of bins in the histogram)
=== hist Returns
A List of containing a tuple for each bin the the histogram. Each tuple contains
summary statistics for the observations that were within the bin.
=== hist Sytnax
hist(numericArray, bins)
== array
The array function returns an array of numerics or other objects including other arrays.
=== array Parameters
* `numeric` | `array` ...
=== array Returns
array
=== array Syntax
array(1, 2, 3) // Array of numerics
array(array(1,2,3), array(4,5,6)) // Array of arrays
== sequence
The `sequence` function returns an array of numbers based on its parameters.
=== sequence Parameters
* `length`
* `start`
* `stride`
=== sequence Returns
numeric array
=== sequence Syntax
sequence(100, 0, 1) // Returns a sequence of length 100, starting from 0 with a stride of 1.
== finddelay
The `finddelay` function performs a cross-correlation between two numeric arrays and returns the delay.
=== finddelay Parameters
* `numeric array`
* `numeric array`
=== finddelay Returns
Integer delay
=== finddelay Syntax
finddelay(numericArray1, numericArray2)
== describe
The `describe` function returns a tuple containing the desciptive statistics for an array.
=== describe Parameters
* `numeric array`
=== describe Returns
Tuple containing descriptive statistics
=== describe Syntax
describe(numericArray)
== copyOfRange
The `copyOfRange` function creates a copy of a range of a numeric array.
=== copyOfRange Parameters
* `numeric array`
* `start index`
* `end index`
=== copyOfRange Returns
A copy of an arrar starting from the start index inclusive and ending at the end index
exclusive.
=== copyOfRange Syntax
copyOfRange(numericArray, startIndex, endIndex)
== copyOf
The `copyOf` function creates a copy of a numeric array.
=== copyOf Parameters
* `numeric array`
* `length`
=== copyOf Returns
A copy of the numeric array starting from zero of size of the length parameter. The returned
array will be right padded with zeros if the length parameter exceeds the size of the
original array.
=== copyOf Syntax
copyOf(numericArray, length)
== distance
The `distance` function calculates the Euclidian distance of two numeric arrays.
=== distance Parameters
* `numeric array`
* `numeric array`
=== distance Returns
number
=== distance Syntax
distance(numericArray1, numuericArray2))
== scale
The `scale` function multiplies all the elements of an array by a number.
=== scale Parameters
* `number`
* `numeric array`
=== scale Returns
A numeric array with the scaled values
=== scale Syntax
scale(number, numericArray)
== rank
The `rank` performs a *rank transformaion* on a numeric array.
=== rank Parameters
* `numeric array`
=== rank Returns
numeric array with rank transformed values
=== rank Syntax
rank(numericArray)
== length
The `length` function returns the length of a numeric array.
=== length Parameters
* `numeric array`
=== length Returns
integer
=== length Syntax
length(numericArray)
== rev
The `rev` function reverses the order of a numeric array.
=== rev Parameters
* `numeric array`
=== rev Returns
A copy of a numeric array with its elements reveresed.
=== rev Syntax
rev(numericArray)
== regress
The `regress` function performs a simple regression on two numeric arrays.
=== regress Parameters
* `numeric array`
* `numeric array`
=== regress Returns
A regression result tuple which holds the regression results. The regression
result tuple is also used by the predict function.
=== regress Syntax
regress(numericArray1, numericArray2)
== predict
The `predict` function predicts the value of an dependent variable based on
the output of the regress function.
=== predict Parameters
* `regress output`
* `numeric predictor`
=== predict Returns
The predicted value
=== predict Syntax
predict(regressOutput, predictor)
== col
The `col` function returns a numeric array from a list of Tuples. The col
function is used to create numeric arrays from stream sources.
=== col Parameters
* `list of Tuples`
* `field name`
=== col Returns
A numeric array from a list of tuples. The field name parameter specifies which field
to create the array from.
=== col Syntax
col(tupleList, fieldName)
== cov
The `cov` function returns the covariance of two numeric arrays.
=== cov Parameters
* `numeric array`
* `numeric array`
=== cov Returns
Number
=== cov Syntax
cov(numericArray, numericArray)
== corr
The `corr` function returns the Pearson Product Moment Correlation of two numeric arrays.
=== corr Parameters
* `numeric array`
* `numeric array`
=== corr Returns
double between -1 and 1
=== corr Synax
corr(numericArray1, numericArray2)
== conv
The `conv` function returns the convolution (https://en.wikipedia.org/wiki/Convolution) of two numeric arrays.
=== conv Parameters
* `numeric array`
* `numeric array`
=== conv Returns
A numeric array with the convolution of the two array parameters.
=== conv Syntax
conv(numericArray1, numericArray2)
== normalize
The `normalize` function normalizes a numeric array so that values within the array
have a mean of 0 and standard deviation of 1.
=== normalize Parameters
* `numeric array`
=== normalize Returns
A numeric array with normalized values.
=== normalize Syntax
normalize(numericArray)