随机逻辑回归
此函数实现随机逻辑回归。它可用于二元分类问题,支持与随机线性回归相同的自定义参数,并以相同的方式工作。
参数
参数与随机线性回归完全相同:学习率
、L2 正则化系数
、小批量大小
、更新权重的方法
。有关更多信息,请参阅参数。
stochasticLogisticRegression(1.0, 1.0, 10, 'SGD')
1. 拟合
See the `Fitting` section in the [stochasticLinearRegression](#stochasticlinearregression-usage-fitting) description.
Predicted labels have to be in \[-1, 1\].
2. 预测
Using saved state we can predict probability of object having label `1`.
``` sql
WITH (SELECT state FROM your_model) AS model SELECT
evalMLMethod(model, param1, param2) FROM test_data
```
The query will return a column of probabilities. Note that first argument of `evalMLMethod` is `AggregateFunctionState` object, next are columns of features.
We can also set a bound of probability, which assigns elements to different labels.
``` sql
SELECT ans < 1.1 AND ans > 0.5 FROM
(WITH (SELECT state FROM your_model) AS model SELECT
evalMLMethod(model, param1, param2) AS ans FROM test_data)
```
Then the result will be labels.
`test_data` is a table like `train_data` but may not contain target value.
另请参阅