2019-06-07 14:14:50 +00:00
|
|
|
DROP TABLE IF EXISTS defaults;
|
|
|
|
CREATE TABLE defaults
|
2019-01-28 10:51:33 +00:00
|
|
|
(
|
|
|
|
param1 Float64,
|
|
|
|
param2 Float64,
|
|
|
|
target Float64,
|
|
|
|
predict1 Float64,
|
|
|
|
predict2 Float64
|
|
|
|
) ENGINE = Memory;
|
2019-06-07 14:14:50 +00:00
|
|
|
insert into defaults values (-3.273, -1.452, 4.267, 20.0, 40.0), (0.121, -0.615, 4.290, 20.0, 40.0);
|
2019-02-12 21:18:27 +00:00
|
|
|
|
2019-06-07 14:14:50 +00:00
|
|
|
DROP TABLE IF EXISTS model;
|
|
|
|
create table model engine = Memory as select stochasticLinearRegressionState(0.1, 0.0, 2, 'SGD')(target, param1, param2) as state from defaults;
|
2019-02-10 21:16:16 +00:00
|
|
|
|
2019-04-08 21:01:10 +00:00
|
|
|
select ans < -61.374 and ans > -61.375 from
|
2019-06-07 14:14:50 +00:00
|
|
|
(with (select state from remote('127.0.0.1', currentDatabase(), model)) as model select evalMLMethod(model, predict1, predict2) as ans from remote('127.0.0.1', currentDatabase(), defaults));
|
2019-05-30 21:59:40 +00:00
|
|
|
|
|
|
|
SELECT 0 < ans[1] and ans[1] < 0.15 and 0.95 < ans[2] and ans[2] < 1.0 and 0 < ans[3] and ans[3] < 0.05 FROM
|
2019-06-07 14:14:50 +00:00
|
|
|
(SELECT stochasticLinearRegression(0.000001, 0.01, 100)(number, rand() % 100, number) AS ans FROM numbers(1000));
|
|
|
|
|
|
|
|
DROP TABLE model;
|
|
|
|
DROP TABLE defaults;
|