串流評估器參考

串流評估器與串流來源或串流裝飾器不同。串流來源和串流裝飾器都回傳元組串流。串流評估器更像是傳統函式,會評估其參數並回傳結果。該結果可以是單一值、陣列、對應或其他結構。

串流評估器可以巢狀,讓一個評估器的輸出成為另一個評估器的輸入。

串流評估器可以在不同的內容中呼叫。例如,可以單獨呼叫串流評估器,也可以在串流運算式的內容中呼叫。

abs

abs 函式將回傳提供的單一參數的絕對值。如果該值不是數值,abs 函式將無法執行。如果找到 null 值,則將回傳 null 作為結果。

abs 參數

  • 欄位名稱 | 原始數字 | 數字評估器

abs 語法

以下運算式顯示您可以使用 abs 評估器的各種方式。只接受一個參數。回傳數值。

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

acos

acos 函式回傳一個數字的三角反餘弦。

acos 參數

  • 欄位名稱 | 原始數字 | 數字評估器:要回傳反餘弦的值。

acos 語法

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

add

add 函式將採用 2 個或更多數值並將它們相加。如果任何值不是數值,add 函式將無法執行。如果找到 null 值,則將回傳 null 作為結果。

add 參數

  • 欄位名稱 | 原始數字 | 數字評估器

  • 欄位名稱 | 原始數字 | 數字評估器

  • …​…​

  • 欄位名稱 | 原始數字 | 數字評估器

add 語法

以下運算式顯示您可以使用 add 評估器的各種方式。這些參數的數量和順序並不重要,且不限於至少需要兩個參數。回傳數值。

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

analyze

analyze 函式會使用可用的分析器分析文字,並回傳分析器發射的標記清單。可以單獨呼叫 analyze 函式,也可以在 selectcartesianProduct 串流運算式中呼叫。

analyze 參數

  • 欄位名稱 | 原始文字:元組中的欄位或要分析的原始文字。

  • 分析器欄位名稱:要用於分析文字的分析器的欄位名稱。

analyze 語法

以下運算式顯示您可以使用 analyze 評估器的各種方式。

  • 分析原始文字:analyze("hello world", analyzerField)

  • 分析 select 運算式中的文字欄位。這將使用分析器的輸出標註元組:select(expr, analyze(textField, analyzerField) as outField)

  • 使用 cartesianProduct 表達式分析文字欄位。這會將分析器發出的每個 token 以個別的 tuple 形式串流輸出:cartesianProduct(expr, analyze(textField, analyzer) as outField)

and

and 函數會回傳至少 2 個布林參數的邏輯 AND 運算結果。如果任何參數為非布林值或 null,函數將無法執行。回傳布林值。

and 參數

  • 欄位名稱 | 原始布林值 | 布林值評估器

  • 欄位名稱 | 原始布林值 | 布林值評估器

  • …​…​

  • 欄位名稱 | 原始布林值 | 布林值評估器

and 語法

以下表達式顯示使用 and 評估器的各種方式。至少需要兩個參數,但可以使用任意多個。

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)

anova

anova 函數會計算兩個或多個數值陣列的變異數分析

anova 參數

  • 數值陣列 …​ (兩個或多個)

anova 語法

anova(numericArray1, numericArray2) // calculates ANOVA for two numeric arrays
anova(numericArray1, numericArray2, numericArray2) // calculates ANOVA for three numeric arrays

array

array 函數會回傳數值或其他物件(包括其他陣列)的陣列。

array 參數

  • 數值 | 陣列 …​

array 語法

array(1, 2, 3)  // Array of numerics
array(array(1,2,3), array(4,5,6)) // Array of arrays

asin

asin 函數會回傳一個數字的反正弦值。

asin 參數

  • 欄位名稱 | 原始數值 | 數值評估器:要回傳反正弦值的值。

asin 語法

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

atan

atan 函數會回傳一個數字的反正切值。

atan 參數

  • 欄位名稱 | 原始數值 | 數值評估器:要回傳反正切值的值。

atan 語法

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

betaDistribution

betaDistribution 函數會根據其參數回傳一個beta 機率分佈。此函數是機率分佈框架的一部分,旨在與 samplekolmogorovSmirnovcumulativeProbability 函數搭配使用。

betaDistribution 參數

  • double:shape1

  • double:shape2

betaDistribution 回傳

機率分佈函數。

betaDistribution 語法

betaDistribution(1, 5)

binomialCoefficient

binomialCoefficient 函數會回傳二項式係數,即從 n 個元素的集合中選取 k 個元素子集的數量。

binomialCoefficient 參數

  • integer:[n] 集合

  • integer:[k] 子集

binomialCoefficient 回傳

一個 long 值:可以從 n 個元素的集合中選取 k 個元素子集的數量。

binomialCoefficient 語法

binomialCoefficient(8, 3) // Returns the number of 3 element subsets from an 8 element set.

binomialDistribution

binomialDistribution 函數會根據其參數回傳一個二項式機率分佈。此函數是機率分佈框架的一部分,旨在與 sampleprobabilitycumulativeProbability 函數搭配使用。

binomialDistribution 參數

  • integer:試驗次數

  • double:成功機率

binomialDistribution 回傳

機率分佈函數。

binomialDistribution 語法

binomialDistribution(1000, .5)

cbrt

cbrt 函數會回傳一個數字的立方根。

cbrt 參數

  • 欄位名稱 | 原始數值 | 數值評估器:要回傳立方根的值。

cbrt 語法

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

ceil

ceil 函數會將小數值四捨五入到下一個最高整數。

ceil 參數

  • 欄位名稱 | 原始數值 | 數值評估器:要向上四捨五入的小數。

ceil 語法

以下表達式顯示使用 ceil 評估器的各種方式。

ceil(100.4) // returns 101.
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.

col

col 函數會從 tuple 清單回傳數值陣列。col 函數用於從串流來源建立數值陣列。

col 參數

  • tuple 清單

  • 欄位名稱:要從其建立陣列的欄位。

col 語法

col(tupleList, fieldName)

colAt

colAt 函數會將矩陣中特定索引的列回傳為數值陣列。

colAt 參數

  • matrix:要操作的矩陣

  • integer:要回傳的列的索引

colAt 語法

colAt(matrix, 10)

colAt 回傳

數值陣列:矩陣的列

columnCount

columnCount 函數會回傳 matrix 中的列數。

columnCount 參數

  • matrix:要操作的矩陣

columnCount 語法

columnCount(matrix)

columnCount 回傳

integer:矩陣中的列數。

constantDistribution

constantDistribution 函數會根據其參數回傳一個常數機率分佈。此函數是機率分佈框架的一部分,旨在與 samplecumulativeProbability 函數搭配使用。

當取樣時,常數分佈總是回傳其常數值。

constantDistribution 參數

  • double:常數值

constantDistribution 回傳

機率分佈函數。

constantDistribution 語法

constantDistribution(constantValue)

conv

conv 函數會回傳兩個數值陣列的迴旋積

conv 參數

  • 數值陣列

  • 數值陣列

conv 語法

conv(numericArray1, numericArray2)

copyOf

copyOf 函數會建立數值陣列的複本。

copyOf 參數

  • 數值陣列

  • length:複製的陣列長度。如果 length 參數超過原始陣列的大小,則回傳的陣列將在右側以零填補。

copyOf 語法

copyOf(numericArray, length)

copyOfRange

copyOfRange 函數會建立數值陣列範圍的複本。

copyOfRange 參數

  • 數值陣列

  • 起始索引

  • 結束索引

copyOfRange 語法

copyOfRange(numericArray, startIndex, endIndex)

corr

corr 函數會回傳兩個數值陣列的相關性,或矩陣的相關性矩陣。

corr 函數支援 Pearson's、Kendall's 和 Spearman's 相關性。

corr 位置參數

  • 數值陣列:第一個數值陣列

  • 數值陣列:第二個數值陣列

  • matrix:要計算相關性矩陣的矩陣。請注意,相關性是計算矩陣中之間的相關性。

corr 具名參數

  • type:(選用)相關性類型。可能的值為 pearsonskendallsspearmans。預設值為 pearsons

corr 語法

corr(numericArray1, numericArray2) // Compute the Pearsons correlation for two numeric arrays
corr(numericArray1, numericArray2, type=kendalls) // Compute the Kendalls correlation for two numeric arrays
corr(matrix) // Compute the Pearsons correlation matrix for a matrix
corr(matrix, type=spearmans) // Compute the Spearmans correlation matrix for a matrix

corr 回傳

數值 | 矩陣:相關性或相關性矩陣。

cos

cos 函數會回傳一個數字的三角餘弦值。

cos 參數

  • 欄位名稱 | 原始數值 | 數值評估器:要回傳雙曲餘弦值的值。

cos 語法

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

cosineSimilarity

cosineSimilarity 函數會回傳兩個數值陣列的餘弦相似度

cosineSimilarity 參數

  • 數值陣列

  • 數值陣列

cosineSimilarity 回傳

一個數值。

cosineSimilarity 語法

cosineSimilarity(numericArray, numericArray)

cov

cov 函數會回傳兩個數值陣列的共變異數,或矩陣的共變異數矩陣。

cov 參數

  • 數值陣列:第一個數值陣列

  • 數值陣列:第二個數值陣列

  • matrix:要從其計算共變異數矩陣的矩陣。請注意,共變異數是計算矩陣中之間的共變異數。

cov 語法

cov(numericArray, numericArray) // Computes the covariance of a two numeric arrays
cov(matrix) // Computes the covariance matrix for the matrix.

cov 回傳

數值 | 矩陣:共變異數或共變異數矩陣。

cumulativeProbability

cumulativeProbability 函數會回傳機率分佈中隨機變數的累積機率。累積機率是指所有小於或等於某個隨機變數的隨機變數的總機率。

cumulativeProbability 參數

  • 機率分佈

  • number:要計算機率的值。

cumulativeProbability 回傳

一個 double 值:累積機率。

cumulativeProbability 語法

cumulativeProbability(normalDistribution(500, 25), 502) // Returns the cumulative probability of the random sample 502 in a normal distribution with a mean of 500 and standard deviation of 25.

derivative

derivative 函數會回傳函數的導數。這個導數函數可以計算樣條函數和loess函數的導數。導數函數也可以計算導數的導數。

derivative 參數

  • spline | loess | akima | lerp | derivative:要計算導數的函數。

derivative 語法

derivative(spline(...))
derivative(loess(...))
derivative(derivative(...))

derivative 回傳值

函數:這個函數可以被視為 數值陣列函數

describe

describe 函數會回傳包含陣列描述性統計資料的元組。

describe 參數

  • 數值陣列

describe 語法

describe(numericArray)

diff

diff 函數執行時間序列差分

時間序列差分通常用於在進一步分析之前,使時間序列達到平穩狀態。

diff 參數

  • 數值陣列:時間序列資料。

  • 整數:(可選) 延遲值。預設為 1。

diff 語法

diff(numericArray1) // Perform time series differencing with a default lag of 1.
diff(numericArray1, 30) // Perform time series differencing with a lag of 30.

diff 回傳值

數值陣列:差分過的時間序列資料。陣列的大小會等於(原始陣列大小 - 延遲值)。

distance

distance 函數計算兩個數值陣列之間的距離,或是一個矩陣的距離矩陣。

distance 位置參數

  • 數值陣列:第一個數值陣列

  • 數值陣列:第二個數值陣列

  • 矩陣:要計算距離矩陣的矩陣。請注意,距離是在矩陣中的之間計算。

distance 名稱參數

  • type:(可選) 距離類型。可能的值為 euclideanmanhattancanberraearthMovers。預設值為 euclidean

distance 語法

distance(numericArray1, numericArray2) // Computes the euclidean distance for two numeric arrays.
distance(numericArray1, numericArray2, type=manhattan) // Computes the manhattan distance for two numeric arrays.
distance(matrix) // Computes the euclidean distance matrix for a matrix.
distance(matrix, type=canberra) // Computes the canberra distance matrix for a matrix.

distance 回傳值

數字 | 矩陣:距離或距離矩陣。

div

div 函數會將兩個數值相除。如果任何值是非數值或 null,或是第二個值為 0,則函數會執行失敗。回傳一個數值。

div 參數

  • 欄位名稱 | 原始數字 | 數字評估器

  • 欄位名稱 | 原始數字 | 數字評估器

div 語法

下面的表示式顯示您可以使用 div 評估器的各種方式。第一個值將除以第二個值,因此第二個值不能為 0。

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)

dotProduct

dotProduct 函數會回傳兩個數值陣列的點積

dotProduct 參數

  • 數值陣列

  • 數值陣列

dotProduct 回傳值

一個數字。

dotProduct 語法

dotProduct(numericArray, numericArray)

ebeAdd

ebeAdd 函數執行兩個數值陣列的逐元素相加。

ebeAdd 參數

  • 數值陣列

  • 數值陣列

ebeAdd 回傳值

一個數值陣列。

ebeAdd 語法

ebeAdd(numericArray, numericArray)

ebeDivide

ebeDivide 函數執行兩個數值陣列的逐元素相除。

ebeDivide 參數

  • 數值陣列

  • 數值陣列

ebeDivide 回傳值

一個數值陣列。

ebeDivide 語法

ebeDivide(numericArray, numericArray)

ebeMultiple

ebeMultiply 函數執行兩個數值陣列的逐元素相乘。

ebeMultiply 參數

  • 數值陣列

  • 數值陣列

ebeMultiply 回傳值

一個數值陣列。

ebeMultiply 語法

ebeMultiply(numericArray, numericArray)

ebeSubtract

ebeSubtract 函數執行兩個數值陣列的逐元素相減。

ebeSubtract 參數

  • 數值陣列

  • 數值陣列

ebeSubtract 回傳值

一個數值陣列。

ebeSubtract 語法

ebeSubtract(numericArray, numericArray)

empiricalDistribution

empiricalDistribution 函數會回傳經驗分佈函數,這是一個基於實際數據集的連續機率分佈函數。這個函數是機率分佈框架的一部分,旨在與 samplekolmogorovSmirnovcumulativeProbability 函數搭配使用。

這個函數旨在處理連續數據。若要從離散數據集建構分佈,請使用 enumeratedDistribution

empiricalDistribution 參數

  • 數值陣列:經驗觀測值

empiricalDistribution 回傳值

機率分佈函數。

empiricalDistribution 語法

empiricalDistribution(numericArray)

enumeratedDistribution

enumeratedDistribution 函數會回傳基於實際數據集或預先定義的數據和機率集合的離散機率分佈函數。這個函數是機率分佈框架的一部分,旨在與 sampleprobabilitycumulativeProbability 函數搭配使用。

enumeratedDistribution 可以透過兩種不同的情境呼叫

  1. 單一離散值陣列。這就像離散數據的經驗分佈。

  2. 單一離散值陣列和代表離散值機率的雙精度值陣列。

這個函數旨在處理離散數據。若要從連續數據集建構分佈,請使用 empiricalDistribution

enumeratedDistribution 參數

  • 整數陣列:離散觀測值或單一離散值。

  • 雙精度陣列:(可選) 代表單一離散值機率的值。

enumeratedDistribution 回傳值

機率分佈函數。

enumeratedDistribution 語法

enumeratedDistribution(integerArray) // This creates an enumerated distribution from the observations in the numeric array.
enumeratedDistribution(array(1,2,3,4), array(.25,.25,.25,.25)) // This creates an enumerated distribution with four discrete values (1,2,3,4) each with a probability of .25.

eor

eor 函數會回傳至少兩個布林參數的邏輯互斥或。如果任何參數是非布林值或 null,則函數會執行失敗。回傳一個布林值。

eor 參數

  • 欄位名稱 | 原始布林值 | 布林值評估器

  • 欄位名稱 | 原始布林值 | 布林值評估器

  • …​…​

  • 欄位名稱 | 原始布林值 | 布林值評估器

eor 語法

下面的表示式顯示您可以使用 eor 評估器的各種方式。至少需要兩個參數,但您可以使用多少個參數沒有限制。

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

eq

eq 函數會根據 Java 的標準 equals(…​) 函數,回傳所有參數是否相等。這個函數接受任何類型的參數,但是如果所有參數的類型不同,則會執行失敗。也就是說,全部都是布林值,全部都是字串,或是全部都是數值。如果任何參數為 null,且至少有一個參數不是 null,則會回傳 false。回傳一個布林值。

eq 參數

  • 欄位名稱 | 原始值 | 評估器

  • 欄位名稱 | 原始值 | 評估器

  • …​…​

  • 欄位名稱 | 原始值 | 評估器

eq 語法

下面的表示式顯示您可以使用 eq 評估器的各種方式。

eq(1,2) // 1 == 2
eq(1,fieldA) // 1 == fieldA
eq(fieldA,val(foo)) fieldA == "foo"
eq(add(fieldA,fieldB),6) // fieldA + fieldB == 6

expMovingAge

expMovingAverage 函數會計算數值陣列的指數移動平均

expMovingAge 參數

  • 數值陣列:要從中計算指數移動平均的陣列。

  • 整數:視窗大小

expMovingAvg 回傳值

一個數值陣列。回傳陣列的第一個元素將會從原始陣列的視窗大小 - 1 的索引開始。

expMovingAvg 語法

expMovingAvg(numericArray, 5) //Computes an exponential moving average with a window size of 5.

factorial

factorial 函數會回傳其參數的階乘

factorial 參數

  • 整數:要計算階乘的值。此參數支援的最大值為 170。

factorial 回傳值

一個雙精度浮點數。

factorial 語法

factorial(100) //Computes the factorial of 100

finddelay

finddelay 函數會在兩個數值陣列之間執行交叉相關,並回傳延遲值。

finddelay 參數

  • 數值陣列

  • 數值陣列

finddelay 語法

finddelay(numericArray1, numericArray2)

floor

floor 函數會將十進位值四捨五入到下一個最小的整數。

floor 參數

  • 欄位名稱 | 原始數字 | 數字評估器:要向下四捨五入的十進位值。

floor 語法

下面的表示式顯示您可以使用 floor 評估器的各種方式。

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.

freqTable

freqTable 函數會從離散值陣列回傳頻率分佈

這個函數旨在處理離散值。若要處理連續數據,請使用 hist 函數。

freqTable 參數

  • 整數陣列:要從中建構頻率分佈的值。

freqTable 回傳值

一個包含每個離散值的頻率資訊的元組列表。

freqTable 語法

freqTable(integerArray)

gammaDistribution

gammaDistribution 函數會根據其參數回傳伽瑪機率分佈。這個函數是機率分佈框架的一部分,旨在與 samplekolmogorovSmirnovcumulativeProbability 函數搭配使用。

gammaDistribution 參數

  • 雙精度浮點數:形狀

  • 雙精度浮點數:尺度

gammaDistribution 回傳值

一個機率分佈函數。

gammaDistribution 語法

gammaDistribution(1, 10)

geometricDistribution

geometricDistribution 函數會根據其參數返回一個幾何機率分佈。此函數是機率分佈框架的一部分,旨在與sampleprobabilitycumulativeProbability 函數一起使用。

geometricDistribution 參數

  • double:機率

geometricDistribution 語法

geometricDistribution(.5) // Creates a geometric distribution with probability of .5

geometricDistribution 返回值

一個機率分佈函數

getAttribute

getAttribute 函數會根據鍵值從 matrix 返回屬性。任何返回 matrix 的函數也可以使用額外資訊在 matrix 上設定屬性。setAttribute 函數也可以用來在 matrix 上設定屬性。屬性的鍵值永遠是字串。屬性的值可以是任何物件,包括數值、陣列、對應、矩陣等。

getAttribute 參數

  • matrix:要設定屬性的矩陣

  • string:屬性的鍵值

getAttribute 語法

getAttribute(matrix, key)

getAttribute 返回值

object:任何物件

getAttributes

getAttributes 函數會從矩陣返回屬性對應。有關屬性的詳細資訊,請參閱 getAttribute 函數。

getAttributes 參數

  • matrix:要從中擷取屬性對應的矩陣。

getAttributes 語法

getAttributes(matrix)

getAttributes 返回值

map:屬性的對應。

getColumnLabels

getColumnLabels 函數會返回矩陣的欄標籤。欄標籤可以由任何返回矩陣的函數選擇性地設定。也可以透過 setColumnLabels 函數設定欄標籤。

getColumnLabels 參數

  • matrix:要返回欄標籤的矩陣。

getColumnLabels 語法

getColumnLabels(matrix)

getColumnLabels 返回值

字串陣列:矩陣中每一欄的標籤

getRowLabels

getRowLabels 函數會返回矩陣的列標籤。列標籤可以由任何返回矩陣的函數選擇性地設定。也可以透過 setRowLabels 函數設定列標籤。

getRowLabels 參數

  • matrix:要從中返回列標籤的矩陣。

getRowLabels 語法

getRowLabels(matrix)

getRowLabels 返回值

字串陣列:矩陣中每一列的標籤

getValue

getValue 函數會根據鍵值返回單一元組項目的值。

getValue 參數

  • tuple:要從中返回項目的元組。

  • key:要返回值的項目的鍵值。

getValue 語法

getValue(tuple, key)

getValue 返回值

object:返回與元組項目相同類型的物件。

grandSum

grandSum 函數會將矩陣中的所有值加總。

grandSum 參數

  • matrix:要操作的矩陣。

grandSum 語法

grandSum(matrix)

grandSum 返回值

number:矩陣中所有值的總和。

gt

gt 函數會返回第一個參數是否大於第二個參數。此函數接受數值或字串參數,但如果所有參數不是相同類型,則會無法執行。也就是說,全部都是字串或全部都是數值。如果任何參數為 null,則會引發錯誤。返回布林值。

gt 參數

  • 欄位名稱 | 原始值 | 評估器

  • 欄位名稱 | 原始值 | 評估器

gt 語法

下面的表示式顯示可以使用 gt 評估器的各種方式。

gt(1,2) // 1 > 2
gt(1,fieldA) // 1 > fieldA
gt(fieldA,val(foo)) // fieldA > "foo"
gt(add(fieldA,fieldB),6) // fieldA + fieldB > 6

gteq

gteq 函數會返回第一個參數是否大於或等於第二個參數。此函數接受數值和字串參數,但如果所有參數不是相同類型,則會無法執行。也就是說,全部都是字串或全部都是數值。如果任何參數為 null,則會引發錯誤。返回布林值。

gteq 參數

  • 欄位名稱 | 原始值 | 評估器

  • 欄位名稱 | 原始值 | 評估器

gteq 語法

下面的表示式顯示可以使用 gteq 評估器的各種方式。

gteq(1,2) // 1 >= 2
gteq(1,fieldA) // 1 >= fieldA
gteq(fieldA,val(foo)) fieldA >= "foo"
gteq(add(fieldA,fieldB),6) // fieldA + fieldB >= 6

hist

hist 函數會從數值陣列建立直方圖。hist 函數旨在與連續變數一起使用。

hist 參數

  • 數值陣列

  • bins:直方圖中的組數。每個返回的元組都包含組內觀測值的摘要統計資料。

hist 語法

hist(numericArray, bins)

hsin

hsin 函數會返回數字的三角雙曲正弦值。

hsin 參數

  • 欄位名稱 | 原始數字 | 數字評估器:要返回雙曲正弦值的值。

hsin 語法

hsin(100.4)  // returns the hsine of 100.4
hsin(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

if

if 函數的作用類似標準的條件 if/then 陳述式。如果第一個參數為 true,則會返回第二個參數,否則會返回第三個參數。此函數接受布林值作為第一個參數,而任何值作為第二個和第三個參數。如果第一個參數不是布林值或為 null,則會發生錯誤。

if 參數

  • 欄位名稱 | 原始值 | 布林值評估器

  • 欄位名稱 | 原始值 | 評估器

  • 欄位名稱 | 原始值 | 評估器

if 語法

下面的表示式顯示可以使用 if 評估器的各種方式。

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

indexOf

indexOf 函數會返回字串在字串陣列中的索引。

indexOf 參數

  • 字串陣列:要操作的陣列。

  • 字串:要在陣列中搜尋的字串。

indexOf 語法

indexOf(stringArray, string)

indexOf 返回值

integer:字串在陣列中的索引,如果找不到字串,則為 -1。

integrate

integrate 函數會計算內插函數在曲線特定範圍內的積分。

integrate 參數

  • spline | akima | lerp | loess:要計算積分的內插函數。

  • numeric:積分範圍的開始

  • numeric:積分範圍的結束

integrate 語法

integrate(function, start, end)

integrate 返回值

numeric:積分

length

length 函數會返回數值陣列的長度。

length 參數

  • 數值陣列

length 語法

length(numericArray)

lerp

loess

leoss 函數是一個平滑曲線擬合器,它使用局部迴歸演算法。與觸及每個控制點的 spline 函數不同,loess 函數會將平滑曲線穿過控制點,而不需要觸及控制點。loess 結果可以由 derivative 函數用來從不平滑的資料產生平滑導數。

loess 位置參數

  • 數值陣列:(選用)x 值。如果省略,則會為 x 值建立序列。

  • 數值陣列:y 值

loess 命名參數

  • bandwidth:(選用)繪製局部迴歸線時要使用的資料點百分比,預設為 .25。減少頻寬會增加 loess 可以擬合的曲線數。

  • robustIterations:(選用)用來平滑離群值的迭代次數,預設為 2。

loess 語法

loess(yValues) // This creates the xValues automatically and fits a smooth curve through the data points.
loess(xValues, yValues) // This will fit a smooth curve through the data points.
loess(xValues, yValues, bandwidth=.15) // This will fit a smooth curve through the data points using 15 percent of the data points for each local regression line.

loess 返回值

function:該函數可以視為平滑資料點的 數值陣列function

log

log 函數會返回所提供單一參數的自然對數。如果值是非數值,則 log 函數會無法執行。如果找到 null 值,則會將 null 作為結果返回。

log 參數

  • 欄位名稱 | 原始數字 | 數字評估器

log 語法

下面的表示式顯示可以使用 log 評估器的各種方式。只接受一個參數。返回一個數值。

log(100)
log(add(fieldA,fieldB))
log(fieldA)

logNormalDistribution

logNormalDistribution 函數會根據其參數返回一個對數常態機率分佈。此函數是機率分佈框架的一部分,旨在與 samplekolmogorovSmirnovcumulativeProbability 函數一起使用。

logNormalDistribution 參數

  • 雙精度浮點數:形狀

  • 雙精度浮點數:尺度

logNormalDistribution 返回值

機率分佈函數。

logNormalDistribution 語法

logNormalDistribution(.3, .0)

kolmogorovSmirnov

kolmogorovSmirnov 函數會執行Kolmogorov Smirnov 檢定,在參考連續機率分佈與樣本集之間執行。

kolmogorovSmirnov 參數

  • 連續機率分佈:參考分佈

  • 數值陣列:樣本集

kolmogorovSmirnov 返回值

結果元組:一個包含檢定結果的 p 值和 d 統計值的元組。

kolmogorovSmirnov 語法

kolmogorovSmirnov(normalDistribution(10, 2), sampleSet)

lt

lt 函數會返回第一個參數是否小於第二個參數。此函數接受數值或字串參數,但如果所有參數不是相同類型,則會無法執行。也就是說,全部都是字串或全部都是數值。如果任何參數為 null,則會引發錯誤。返回布林值。

lt 參數

  • 欄位名稱 | 原始值 | 評估器

  • 欄位名稱 | 原始值 | 評估器

lt 語法

下面的表示式顯示可以使用 lt 評估器的各種方式。

lt(1,2) // 1 < 2
lt(1,fieldA) // 1 < fieldA
lt(fieldA,val(foo)) fieldA < "foo"
lt(add(fieldA,fieldB),6) // fieldA + fieldB < 6

lteq

lteq 函數會返回第一個參數是否小於或等於第二個參數。此函數接受數值和字串參數,但如果所有參數的類型不相同,則會執行失敗。也就是說,所有參數都必須是字串或所有參數都必須是數值。如果任何參數為 null,則會引發錯誤。返回布林值。

lteq 參數

  • 欄位名稱 | 原始值 | 評估器

  • 欄位名稱 | 原始值 | 評估器

lteq 語法

以下表達式顯示使用 lteq 評估器的各種方式。

lteq(1,2) // 1 <= 2
lteq(1,fieldA) // 1 <= fieldA
lteq(fieldA,val(foo)) fieldA <= "foo"
lteq(add(fieldA,fieldB),6) // fieldA + fieldB <= 6

markovChain

markovChain 函數可用於執行馬可夫鏈模擬。 markovChain 函數將轉移矩陣作為其參數,並返回一個可以使用 sample 函數取樣的數學模型。從馬可夫鏈取得的每個樣本都表示系統的當前狀態。

markovChain 參數

  • matrix:轉移矩陣

markovChain 語法

sample(markovChain(transitionMatrix), 5)  // This creates a Markov Chain given a specific transition matrix.
The sample function takes 5 samples from the Markov Chain, representing the next five states of the system.

markovChain 返回值

馬可夫鏈模型:馬可夫鏈模型可以與 sample 函數一起使用。

matrix

matrix 函數會返回一個矩陣,該矩陣可以由支援矩陣運算的函數操作。

matrix 參數

  • numeric array …​:一個或多個將作為矩陣行的數值陣列。

matrix 語法

matrix(numericArray1, numericArray2, numericArray3) // Returns a matrix with three rows of data: numericaArray1, numericArray2, numericArray3

matrix 返回值

矩陣

meanDifference

meanDifference 函數會計算兩個數值陣列之間逐元素相減後差值的平均值。

meanDifference 參數

  • 數值陣列

  • 數值陣列

meanDifference 返回值

一個數值。

meanDifference 語法

meanDifference(numericArray, numericArray)

minMaxScale

minMaxScale 函數會在最小值和最大值範圍內縮放數值陣列。預設情況下,minMaxScale 會在 0 和 1 之間縮放。minMaxScale 函數可以對數值陣列和矩陣進行操作。

在矩陣上操作時,minMaxScale 函數會對矩陣的每一列進行操作。

minMaxScale 參數

  • numeric array | matrix:要縮放的陣列或矩陣

  • double:(可選)最小值。預設為 0。

  • double:(可選)最大值。預設為 1。

minMaxScale 語法

minMaxScale(numericArray) // scale a numeric array between 0 and 1
minMaxScale(numericArray, 0, 100) // scale a numeric array between 1 and 100
minMaxScale(matrix) // Scale each row in a matrix between 0 and 1
minMaxScale(matrix, 0, 100) // Scale each row in a matrix between 0 and 100

minMaxScale 返回值

數值陣列或矩陣

mod

mod 函數會返回第一個參數除以第二個參數的餘數(模數)。

mod 參數

  • 欄位名稱 | 原始數字 | 數值評估器:參數 1

  • 欄位名稱 | 原始數字 | 數值評估器:參數 2

mod 語法

以下表達式顯示使用 mod 評估器的各種方式。

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.

monteCarlo

monteCarlo 函數會根據其參數執行蒙地卡羅模擬monteCarlo 函數會執行另一個函數指定的次數並返回結果。執行的函數通常具有一個或多個變數,這些變數在每次執行時會從機率分佈中提取。 sample 函數用於在函數中提取樣本。

模擬結果陣列接著可以被視為經驗分佈,以了解模擬結果的機率。

monteCarlo 參數

  • numeric function:模擬執行的函數,必須返回數值。

  • integer:執行函數的次數。

monteCarlo 返回值

數值陣列:模擬執行的結果。

monteCarlo 語法

let(a=uniformIntegerDistribution(1, 6),
    b=uniformIntegerDistribution(1, 6),
    c=monteCarlo(add(sample(a), sample(b)), 1000))

在上面的表達式中,monteCarlo 函數執行函數 add(sample(a), sample(b)) 1000 次並返回結果。每次執行函數時,都會從變數 ab 中儲存的機率分佈中提取樣本。

movingAvg

movingAvg 函數會計算數字陣列的移動平均值

movingAvg 參數

  • 數值陣列

  • 視窗大小

movingAvg 返回值

一個數值陣列。回傳陣列的第一個元素將會從原始陣列的視窗大小 - 1 的索引開始。

movingAvg 語法

movingAverage(numericArray, 30)

movingMedian

movingMedian 函數會計算數字陣列的移動中位數。

movingMedian 參數

  • 數值陣列

  • 視窗大小

movingMedian 返回值

一個數值陣列。回傳陣列的第一個元素將會從原始陣列的視窗大小 - 1 的索引開始。

movingMedian 語法

movingMedian(numericArray, 30)

mult

mult 函數會將兩個或多個數值相乘。如果任何值不是數值,則 mult 函數將執行失敗。如果找到 null 值,則會將 null 作為結果返回。

mult 參數

  • 欄位名稱 | 原始數字 | 數字評估器

  • 欄位名稱 | 原始數字 | 數字評估器

  • …​…​

  • 欄位名稱 | 原始數字 | 數字評估器

mult 語法

以下表達式顯示使用 mult 評估器的各種方式。這些參數的數量和順序並不重要,並且沒有限制,但至少需要兩個參數。返回數值。

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

normalDistribution

normalDistribution 函數會根據其參數返回常態機率分佈。此函數是機率分佈框架的一部分,旨在與 samplekolmogorovSmirnovcumulativeProbability 函數一起使用。

normalDistribution 參數

  • double:平均值

  • double:標準差

normalDistribution 返回值

機率分佈函數。

normalDistribution 語法

normalDistribution(mean, stddev)

normalizeSum

normalizeSum 函數會縮放數值陣列,使其總和為 1。normalizeSum 函數可以對數值陣列和矩陣進行操作。

在矩陣上操作時,normalizeSum 函數會對矩陣的每一列進行操作。

normalizeSum 參數

  • numeric array | matrix

normalizeSum 語法

normalizeSum(numericArray)
normalizeSum(matrix)

normalizeSum 返回值

數值陣列 | 矩陣

not

not 函數會返回單個布林參數的邏輯 NOT。如果參數不是布林值或為 null,則函數將執行失敗。返回布林值。

not 參數

  • 欄位名稱 | 原始布林值 | 布林值評估器

not 語法

以下表達式顯示使用 not 評估器的各種方式。只允許一個參數。

not(true) // false
not(fieldA) // true if fieldA is false else false
not(eq(fieldA,fieldB)) // true if fieldA != fieldB

olsRegress

olsRegress 函數會執行普通最小平方法、多元線性迴歸。

olsRegress 函數會返回一個包含迴歸模型以及估計迴歸參數、R 平方和迴歸診斷的單一元組。

olsRegress 的輸出可以與 predict 函數一起使用,以根據迴歸模型預測值。

olsRegress 參數

  • matrix:迴歸變數觀測矩陣。矩陣中的每一列代表單個多元迴歸變數觀測。請注意,在指定包含截距項的模型時,不需要新增初始單位列(1 的列),此列將會自動新增。

  • numeric array:與迴歸變數觀測矩陣中的每一列匹配的結果陣列。

olsRegress 語法

olsRegress(matrix, numericArray) // This performs the olsRegression analysis on given regressor matrix and outcome array.

olsRegress 返回值

元組:迴歸模型,包括估計迴歸參數和診斷。

or

or 函數會返回至少 2 個布林參數的邏輯 OR。如果任何參數不是布林值或為 null,則函數將執行失敗。返回布林值。

or 參數

  • 欄位名稱 | 原始布林值 | 布林值評估器

  • 欄位名稱 | 原始布林值 | 布林值評估器

  • …​…​

  • 欄位名稱 | 原始布林值 | 布林值評估器

or 語法

以下表達式顯示使用 or 評估器的各種方式。至少需要兩個參數,但您可以使用的數量沒有限制。

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)

poissonDistribution

poissonDistribution 函數會根據其參數返回泊松機率分佈。此函數是機率分佈框架的一部分,旨在與 sampleprobabilitycumulativeProbability 函數一起使用。

poissonDistribution 參數

  • double:平均值

poissonDistribution 返回值

機率分佈函數。

poissonDistribution 語法

poissonDistribution(mean)

polyFit

polyFit 函數會執行多項式曲線擬合

polyFit 參數

  • 數值陣列:(選用)x 值。如果省略,則會為 x 值建立序列。

  • 數值陣列:y 值

  • integer:(可選)多項式次數。預設為 3。

polyFit 返回值

數值陣列:擬合到資料點的曲線。

polyFit 語法

polyFit(yValues) // This creates the xValues automatically and fits a curve through the data points using the default 3 degree polynomial.
polyFit(yValues, 5) // This creates the xValues automatically and fits a curve through the data points using a 5 degree polynomial.
polyFit(xValues, yValues, 5) // This will fit a curve through the data points using a 5 degree polynomial.

pow

pow 函數會返回第一個參數的值,該值會提高到第二個參數的冪次方。

pow 參數

  • 欄位名稱 | 原始數字 | 數值評估器:參數 1

  • 欄位名稱 | 原始數字 | 數值評估器:參數 2

pow 語法

以下表達式展示了您可以使用 pow 評估器的各種方式。

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.

predict

predict 函式基於迴歸模型或函式預測應變數的值。

predict 函式可以基於以下函式的輸出預測值:splineloessregressolsRegress

predict 參數

  • 迴歸模型 | 函式:用於預測的模型或函式

  • 數值 | 數值陣列 | 矩陣:根據所使用的迴歸模型或函式,預測變數可以是數值、數值陣列或矩陣。

predict 語法

predict(regressModel, number) // predict using the output of the <<regress>> function and single numeric predictor. This will return a single numeric prediction.

predict(regressModel, numericArray) // predict using the output of the <<regress>> function and a numeric array of predictors. This will return a numeric array of predictions.

predict(splineFunc, number) // predict using the output of the <<spline>> function and single numeric predictor. This will return a single numeric prediction.

predict(splineFunc, numericArray) // predict using the output of the <<spline>> function and a numeric array of predictors. This will return a numeric array of predictions.

predict(olsRegressModel, numericArray) // predict using the output of the <<olsRegress>> function and a numeric array containing one multi-variate predictor. This will return a single numeric prediction.

predict(olsRegressModel, matrix) // predict using the output of the <<olsRegress>> function and a matrix containing rows of multi-variate predictor arrays. This will return a numeric array of predictions.

primes

primes 函式會傳回從指定數字開始的質數陣列。

primes 參數

  • 整數:要在清單中傳回的質數數量

  • 整數:傳回質數的起點

primes 傳回值

一個數值陣列。

primes 語法

primes(100, 2000) // returns 100 primes starting from 2000

probability

probability 函式會傳回機率分佈中隨機變數的機率。

probability 函式計算連續離散機率分佈的隨機變數範圍之間的機率。

probability 函式僅能計算離散機率分佈的特定隨機變數的機率。

probability 參數

  • 機率分佈:要從中計算機率的機率分佈。

  • 數值:範圍的低值。

  • 數值:(離散機率分佈為選用)範圍的高值。如果省略高範圍,則機率函式將計算低範圍值的機率。

probability 語法

probability(poissonDistribution(10), 7) // Returns the probability of a random sample of 7 in a poisson distribution with a mean of 10.

probability(normalDistribution(10, 2), 7.5, 8.5) // Returns the probability between the range of 7.5 to 8.5 for a normal distribution with a mean of 10 and standard deviation of 2.

probability 傳回值

double:機率

rank

rank 會對數值陣列執行排名轉換。

rank 參數

  • 數值陣列

rank 語法

rank(numericArray)

raw

raw 函式會傳回參數的任何原始值。這在您想要將字串用作另一個評估器的一部分時非常有用。

raw 參數

  • 原始值

raw 語法

以下表達式展示了您可以使用 raw 評估器的各種方式。 內部內容將按原樣傳回。 內部評估器會被視為字串,不會被評估。

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"

regress

regress 函式會對兩個數值陣列執行簡單迴歸。

此表達式的結果也由 predict 函式使用。

regress 參數

  • 數值陣列

  • 數值陣列

regress 語法

regress(numericArray1, numericArray2)

rev

rev 函式會反轉數值陣列的順序。

rev 參數

  • 數值陣列

rev 語法

rev(numericArray)

round

round 函式會傳回最接近引數的整數。

round 參數

  • 欄位名稱 | 原始數字 | 數字評估器:要傳回平方根的值。

round 語法

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

rowAt

rowAt 函式會傳回矩陣在特定索引的列,作為數值陣列。

rowAt 參數

  • matrix:要操作的矩陣

  • 整數:要傳回的列的索引

rowAt 語法

rowAt(matrix, 10)

rowAt 傳回值

數值陣列:矩陣的列

rowCount

rowCount 函式會傳回 matrix 中的列數。

rowCount 參數

  • matrix:要操作的矩陣

rowCount 語法

rowCount(matrix)

rowCount 傳回值

整數:矩陣中的列數。

sample

sample 函式可用於從機率分佈或馬可夫鏈中提取隨機樣本。

sample 參數

  • 機率分佈 | 馬可夫鏈:要取樣的分佈或馬可夫鏈。

  • 整數:(選用)樣本大小。預設為 1。

sample 傳回值

單一數值隨機樣本,或數值陣列,具體取決於樣本大小參數。

sample 語法

sample(poissonDistribution(5)) // Returns a single random sample from a poissonDistribution with mean of 5.
sample(poissonDistribution(5), 1000) // Returns 1000 random samples from poissonDistribution with a mean of 5.
sample(markovChain(transitionMatrix), 1000) // Returns 1000 random samples from a Markov Chain.

scalarAdd

scalarAdd 函式會將純量值新增至數值陣列或矩陣中的每個值。 使用數值陣列時,scalarAdd 會傳回具有新值的新陣列。 使用矩陣時,scalarAdd 會傳回具有新值的新矩陣。

scalarAdd 參數

數值:要新增的值 數值陣列 | 矩陣:要新增值的數值陣列或矩陣。

scalarAdd 語法

scalarAdd(number, numericArray) // Adds the number to each element in the number in the array.
scalarAdd(number, matrix) // Adds the number to each value in a matrix

scalarAdd 傳回值

numericArray | 矩陣:取決於正在運算的對象。

scalarDivide

scalarDivide 函式會將數值陣列或矩陣中的每個數字除以純量值。 使用數值陣列時,scalarDivide 會傳回具有新值的新陣列。 使用矩陣時,scalarDivide 會傳回具有新值的新矩陣。

scalarDivide 參數

數值:要除以的值 數值陣列 | 矩陣:要除以該值的數值陣列或矩陣。

scalarDivide 語法

scalarDivide(number, numericArray) // Divides each element in the numeric array by the number.
scalarDivide(number, matrix) // Divides each element in the matrix by the number.

scalarDivide 傳回值

numericArray | 矩陣:取決於正在運算的對象。

scalarMultiply

scalarMultiply 函式會將數值陣列或矩陣中的每個元素乘以純量值。 使用數值陣列時,scalarMultiply 會傳回具有新值的新陣列。 使用矩陣時,scalarMultiply 會傳回具有新值的新矩陣。

scalarMultiply 參數

數值:要除以的值 數值陣列 | 矩陣:要除以該值的數值陣列或矩陣。

scalarMultiply 語法

scalarMultiply(number, numericArray) // Multiplies each element in the numeric array by the number.
scalarMultiply(number, matrix) // Multiplies each element in the matrix by the number.

scalarMultiply 傳回值

numericArray | 矩陣:取決於正在運算的對象

scalarSubtract

scalarSubtract 函式會從數值陣列或矩陣中的每個值減去純量值。 使用數值陣列時,scalarSubtract 會傳回具有新值的新陣列。 使用矩陣時,scalarSubtract 會傳回具有新值的新矩陣。

scalarSubtract 參數

數值:要新增的值 數值陣列 | 矩陣:要從中減去該值的數值陣列或矩陣。

scalarSubtract 語法

scalarSubtract(number, numericArray) // Subtracts the number from each element in the number in the array.
scalarSubtract(number, matrix) // Subtracts the number from each value in a matrix

scalarSubtract 傳回值

numericArray | 矩陣:取決於正在運算的對象。

scale

scale 函式會將陣列的所有元素乘以一個數字。

scale 參數

  • 數字

  • 數值陣列

scale 語法

scale(number, numericArray)

sequence

sequence 函式會根據其參數傳回數字陣列。

sequence 參數

  • 長度

  • 起始

  • 間隔

sequence 語法

sequence(100, 0, 1) // Returns a sequence of length 100, starting from 0 with a stride of 1.

setAttributes

setAttributes 函式會設定 matrix 的屬性對應。

setAttributes 參數

  • 矩陣:要設定屬性對應的矩陣。

  • 對應:要設定在矩陣上的屬性對應。

setAttributes 語法

setAttributes(matrix, map)

setAttributes 傳回值

矩陣:已設定屬性的矩陣。

setColumnLabels

setColumnLabels 函式會設定矩陣的欄標籤。

setColumnLabels 參數

  • 矩陣:要設定欄標籤的矩陣。

  • 字串陣列:要設定矩陣的欄標籤

setColumnLabels 語法

setColumnLabels(矩陣, 標籤)

setColumnLabels 傳回值

矩陣:已設定標籤的矩陣。

setRowLabels

setRowLabels 函式會設定矩陣的列標籤。

setRowLabels 參數

  • matrix: 要設定列標籤的矩陣。

  • string array: 要設定給矩陣的列標籤。

setRowLabels 語法

setRowLabels(matrix, labels)

setRowLabels 回傳值

矩陣:已設定標籤的矩陣。

setValue

setValue 函數會為元組項目設定新值。

setValue 參數

  • tuple:要從中返回項目的元組。

  • key: 要設定的項目索引鍵。

  • value: 要設定的值。

setValue 語法

setValue(tuple, key, value)

setValue 回傳值

tuple: 回傳修改後的新元組

sin

sin 函數會回傳數字的三角正弦值。

sin 參數

  • 欄位名稱 | 原始數字 | 數值評估器: 要回傳正弦值的值。

sin 語法

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

spline

spline 函數會對給定的一組 x,y 座標執行三次樣條插值 (https://en.wikiversity.org/wiki/Cubic_Spline_Interpolation)。spline 函數的回傳值是一個插值函數,可用於預測沿曲線的值並產生曲線的導數

spline 參數

  • 數值陣列:(選用)x 值。如果省略,則會為 x 值建立序列。

  • 數值陣列:y 值

spline 語法

spline(yValues) // This creates the xValues automatically and fits a spline through the data points.
spline(xValues, yValues) // This will fit a spline through the data points.

spline 回傳值

function: 該函數可以被視為 數值陣列函數

sqrt

sqrt 函數會回傳數字的三角平方根值。

sqrt 參數

  • 欄位名稱 | 原始數字 | 數值評估器: 要回傳平方根值的值。

sqrt 語法

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

standardize

standardize 函數會將數值陣列標準化,使陣列中的值具有平均值 0 和標準差 1。

standardize 參數

  • 數值陣列: 要標準化的陣列

standardize 語法

standardize(numericArray)

standardize 回傳值

數值陣列: 標準化後的值

sub

sub 函數會取 2 個或更多數值,並從左到右相減。如果任何值不是數值,sub 函數將無法執行。如果找到 null 值,則會將 null 作為結果傳回。

sub 參數

  • 欄位名稱 | 原始數字 | 數字評估器

  • 欄位名稱 | 原始數字 | 數字評估器

  • …​…​

  • 欄位名稱 | 原始數字 | 數字評估器

sub 語法

以下運算式顯示您可以使用 sub 評估器的各種方式。這些參數的數量並不重要,且不受限制,但至少需要兩個參數。回傳數值。

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

sumDifference

sumDifference 函數會計算兩個數值陣列之間逐元素相減後的差之總和。

sumDifference 參數

  • 數值陣列

  • 數值陣列

sumDifference 回傳值

一個數值。

sumDifference 語法

sumDifference(numericArray, numericArray)

sumColumns

sumColumns 函數會將矩陣中的列加總,並回傳具有結果的數值陣列。

sumColumns 參數

  • matrix:要操作的矩陣

sumColumns 語法

sumColumns(matrix)

sumColumns 回傳值

數值陣列: 列的總和

sumRows

sumRows 函數會將矩陣中的列加總,並回傳具有結果的數值陣列。

sumRows 參數

  • matrix:要操作的矩陣

sumRows 語法

sumRows(matrix)

sumRows 回傳值

數值陣列: 列的總和。

sumSq

sumSq 函數會回傳數值陣列中值的平方和。

sumSq 參數

  • 數值陣列: 要計算 sumSq 的數值陣列。

sumSq 語法

sumSq(numericArray)

sumSq 回傳值

numeric: sumSq 計算的結果

transpose

transpose 函數會轉置矩陣。

transpose 參數

  • matrix: 要轉置的矩陣

transpose 語法

transpose(matrix)

transpose 回傳值

matrix: 轉置後的矩陣

triangularDistribution

triangularDistribution 函數會根據其參數回傳一個三角機率分佈。此函數是機率分佈框架的一部分,旨在與 sampleprobabilitycumulativeProbability 函數搭配使用。

triangularDistribution 參數

  • double: 低值

  • double: 最可能的值

  • double: 高值

triangularDistribution 語法

triangularDistribution(10, 15, 20) // A triangular distribution with a low value of 10, most likely value of 15 and high value of 20.

triangularDistribution 回傳值

機率分佈函數

uniformDistribution

uniformDistribution 函數會根據其參數回傳一個連續均勻機率分佈。請參閱 uniformIntegerDistribution 以使用離散均勻分佈。此函數是機率分佈框架的一部分,旨在與 samplecumulativeProbability 函數搭配使用。

uniforDistribution 參數

  • double: 開始

  • double: 結束

uniformDistribution 回傳值

機率分佈函數。

uniformDistribution 語法

uniformDistribution(0.0, 100.0)

uniformIntegerDistribution

uniformIntegerDistribution 函數會根據其參數回傳一個離散均勻機率分佈。請參閱 uniformDistribution 以使用連續均勻分佈。此函數是機率分佈框架的一部分,旨在與 sampleprobabilitycumulativeProbability 函數搭配使用。

uniformIntegerDistribution 參數

  • integer: 開始

  • integer: 結束

uniformIntegerDistribution 回傳值

機率分佈函數。

uniformIntegerDistribution 語法

uniformDistribution(1, 6)

unitize

unitize 函數會將數值陣列縮放到 1 的量級,通常稱為單位向量。unitize 函數可以對數值陣列和矩陣進行操作。

在矩陣上操作時,unitize 函數會將矩陣的每一列單位化。

unitize 參數

  • 數值陣列 | matrix: 要單位化的陣列或矩陣

unitize 語法

unitize(numericArray) // Unitize a numeric array
unitize(matrix) // Unitize each row in a matrix

unitize 回傳值

數值陣列 | 矩陣

weibullDistribution

weibullDistribution 函數會根據其參數回傳一個 Weibull 機率分佈。此函數是機率分佈框架的一部分,旨在與 samplekolmogorovSmirnovcumulativeProbability 函數搭配使用。

weibullDistribution 參數

  • 雙精度浮點數:形狀

  • 雙精度浮點數:尺度

weibullDistribution 回傳值

機率分佈函數。

weibullDistribution 語法

weibullDistribution(.5, 10)

zipFDistribution

zipFDistribution 函數會根據其參數回傳一個 ZipF 分佈。此函數是機率分佈框架的一部分,旨在與 sampleprobabilitycumulativeProbability 函數搭配使用。

zipFDistribution 參數

  • integer: 大小

  • double: 指數

zipFDistribution 回傳值

機率分佈函數。

zipFDistribution 語法

zipFDistribution(5000, 1.0)