提交 ba9cc95f 编写于 作者: B BayoNet 提交者: Ivan Blinkov

DOCAPI-6887: Description of skewPop, skewSamp, kurtPop, kurtSamp functions. (#5544)

上级 ff594aaf
# Function reference
## count() {#agg_function-count}
......@@ -301,6 +300,98 @@ GROUP BY timeslot
└─────────────────────┴──────────────────────────────────────────────┘
```
## skewPop
Computes the [skewness](https://en.wikipedia.org/wiki/Skewness) for sequence.
```
skewPop(expr)
```
**Parameters**
`expr`[Expression](../syntax.md#syntax-expressions) returning a number.
**Returned value**
The skewness of given distribution. Type — [Float64](../../data_types/float.md)
**Example of Use**
```sql
SELECT skewPop(value) FROM series_with_value_column
```
## skewSamp
Computes the [sample skewness](https://en.wikipedia.org/wiki/Skewness) for sequence.
It represents an unbiased estimate of the skewness of a random variable, if passed values form it's sample.
```
skewSamp(expr)
```
**Parameters**
`expr`[Expression](../syntax.md#syntax-expressions) returning a number.
**Returned value**
The skewness of given distribution. Type — [Float64](../../data_types/float.md). If `n <= 1` (`n` is a size of the sample), then the function returns `nan`.
**Example of Use**
```sql
SELECT skewSamp(value) FROM series_with_value_column
```
## kurtPop
Computes the [kurtosis](https://en.wikipedia.org/wiki/Kurtosis) for sequence.
```
kurtPop(expr)
```
**Parameters**
`expr`[Expression](../syntax.md#syntax-expressions) returning a number.
**Returned value**
The kurtosis of given distribution. Type — [Float64](../../data_types/float.md)
**Example of Use**
```sql
SELECT kurtPop(value) FROM series_with_value_column
```
## kurtSamp
Computes the [sample kurtosis](https://en.wikipedia.org/wiki/Kurtosis) for sequence.
It represents an unbiased estimate of the kurtosis of a random variable, if passed values form it's sample.
```
kurtSamp(expr)
```
**Parameters**
`expr`[Expression](../syntax.md#syntax-expressions) returning a number.
**Returned value**
The kurtosis of given distribution. Type — [Float64](../../data_types/float.md). If `n <= 1` (`n` is a size of the sample), then the function returns `nan`.
**Example of Use**
```sql
SELECT kurtSamp(value) FROM series_with_value_column
```
## timeSeriesGroupSum(uid, timestamp, value) {#agg_function-timeseriesgroupsum}
timeSeriesGroupSum can aggregate different time series that sample timestamp not alignment.
It will use linear interpolation between two sample timestamp and then sum time-series together.
......@@ -514,7 +605,7 @@ All the quantile functions also have corresponding quantiles functions: `quantil
Calculates the amount `Σ((x - x̅)^2) / (n - 1)`, where `n` is the sample size and `x̅`is the average value of `x`.
It represents an unbiased estimate of the variance of a random variable, if the values passed to the function are a sample of this random amount.
It represents an unbiased estimate of the variance of a random variable, if passed values form it's sample.
Returns `Float64`. When `n <= 1`, returns `+∞`.
......@@ -595,7 +686,7 @@ Parameters:
Returned values:
Parameters `(a, b)` of the resulting line `x = a*y + b`.
Parameters `(a, b)` of the resulting line `y = a*x + b`.
**Examples**
......@@ -654,11 +745,11 @@ To predict we use function `evalMLMethod`, which takes a state as an argument as
param2 Float64,
target Float64
) ENGINE = Memory;
CREATE TABLE your_model ENGINE = Memory AS SELECT
stochasticLinearRegressionState(0.1, 0.0, 5, 'SGD')(target, param1, param2)
AS state FROM train_data;
```
Here we also need to insert data into `train_data` table. The number of parameters is not fixed, it depends only on number of arguments, passed into `linearRegressionState`. They all must be numeric values.
Note that the column with target value(which we would like to learn to predict) is inserted as the first argument.
......@@ -671,7 +762,7 @@ To predict we use function `evalMLMethod`, which takes a state as an argument as
evalMLMethod(model, param1, param2) FROM test_data
```
The query will return a column of predicted values. Note that first argument of `evalMLMethod` is `AggregateFunctionState` object, next are columns of features.
`test_data` is a table like `train_data` but may not contain target value.
**Some notes**
......@@ -681,12 +772,12 @@ To predict we use function `evalMLMethod`, which takes a state as an argument as
SELECT state1 + state2 FROM your_models
```
where `your_models` table contains both models. This query will return new `AggregateFunctionState` object.
2. User may fetch weights of the created model for its own purposes without saving the model if no `-State` combinator is used.
```sql
SELECT stochasticLinearRegression(0.01)(target, param1, param2) FROM train_data
```
Such query will fit the model and return its weights - first are weights, which correspond to the parameters of the model, the last one is bias. So in the example above the query will return a column with 3 values.
Such query will fit the model and return its weights - first are weights, which correspond to the parameters of the model, the last one is bias. So in the example above the query will return a column with 3 values.
## logisticRegression
......@@ -696,8 +787,8 @@ This function implements stochastic logistic regression. It can be used for bina
#### Parameters
Parameters are exactly the same as in stochasticLinearRegression:
`learning rate`, `l2 regularization coefficient`, `mini-batch size`, `method for updating weights`.
Parameters are exactly the same as in stochasticLinearRegression:
`learning rate`, `l2 regularization coefficient`, `mini-batch size`, `method for updating weights`.
For more information see [parameters](#parameters).
```text
stochasticLogisticRegression(1.0, 1.0, 10, 'SGD')
......@@ -706,9 +797,9 @@ stochasticLogisticRegression(1.0, 1.0, 10, 'SGD')
1. *Fitting*
See *stochasticLinearRegression.Fitting*
Predicted labels have to be in {-1, 1}.
2. *Predicting*
Using saved state we can predict probability of object having label *1*.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册