ClickHouse/dbms/tests/queries/0_stateless/00953_ml_test.sql

26 lines
158 KiB
MySQL
Raw Normal View History

2019-02-15 22:47:56 +00:00
CREATE DATABASE IF NOT EXISTS test;
DROP TABLE IF EXISTS test.defaults;
CREATE TABLE IF NOT EXISTS test.defaults
(
param1 Float64,
param2 Float64,
param3 Float64,
param4 Float64,
param5 Float64,
param6 Float64,
param7 Float64,
target Float64,
predict1 Float64,
predict2 Float64,
predict3 Float64,
predict4 Float64,
predict5 Float64,
predict6 Float64,
predict7 Float64
) ENGINE = Memory;
insert into test.defaults values (2.096042154435875,-1.430135166863733,0.552002055283785,5.530269265662427,-2.724119998880863,-2.727060497877947,-2.6521663150493935,0.0,2.2484776527244863,1.099880417196144,-3.288829727389001,5.753439524022788,-1.8752458625661363,-0.9823515324160276,-1.1222966894793052),(2.156034808051058,-0.4519877395933891,0.34558837162895817,2.2798791370166707,-1.2600139205601857,-2.314726182739184,-0.9176776519268379,0.0,2.2484776527244863,1.099880417196144,-3.288829727389001,5.753439524022788,-1.8752458625661363,-0.9823515324160276,-1.1222966894793052),(2.0227012823747095,0.7073993763424218,-2.526579837235766,2.8884210818462503,-0.04921172682949959,-0.9351603686160936,-0.5773308731642317,1.0,2.2484776527244863,1.099880417196144,-3.288829727389001,5.753439524022788,-1.8752458625661363,-0.9823515324160276,-1.1222966894793052),(1.461704796035435,1.2400054513675245,1.3110456913590716,-1.22465515713176,-0.7935030458046264,-1.103533329941002,0.5919719712269023,0.0,2.2484776527244863,1.099880417196144,-3.288829727389001,5.753439524022788,-1.8752458625661363,-0.9823515324160276,-1.1222966894793052),(2.3957050452186377,-1.9316918657725441,0.9190142057288935,7.155955775162267,-2.8869703029890026,-3.0234929608286194,-4.304748904849194,0.0,2.2484776527244863,1.099880417196144,-3.288829727389001,5.753439524022788,-1.8752458625661363,-0.9823515324160276,-1.1222966894793052),(1.392556430407127,-1.7794168780763924,2.1181012869348086,-0.6814309766916051,2.00404915245683,-1.7928635680687615,-2.425109137822439,0.0,2.2484776527244863,1.099880417196144,-3.288829727389001,5.753439524022788,-1.8752458625661363,-0.9823515324160276,-1.1222966894793052),(1.9685507597915972,0.8408759652866196,-1.2607782469598254,-1.5515619975922614,2.3915793036512913,-0.8003752729444923,0.3318055683772181,1.0,2.2484776527244863,1.099880417196144,-3.288829727389001,5.753439524022788,-1.8752458625661363,-0.9823515324160276,-1.1222966894793052),(0.365215205131582,1.6421911754887804,-0.470904627839269,-2.195888125979813,0.9714278325597505,0.5976321868124256,1.1540464822511913,1.0,2.2484776527244863,1.099880417196144,-3.288829727389001,5.753439524022788,-1.8752458625661363,-0.9823515324160276,-1.1222966894793052),(0.3351152167766934,0.9498577915117139,-0.879126536282473,-2.971335010973352,2.468544204807239,0.5553774318661323,1.093198284507689,1.0,2.2484776527244863,1.099880417196144,-3.288829727389001,5.753439524022788,-1.8752458625661363,-0.9823515324160276,-1.1222966894793052),(0.03912510876000452,-1.3322341365102917,1.6434865408453003,2.7281117051531183,-2.719490284062717,-1.2856678156526198,-1.087994719221058,0.0,2.2484776527244863,1.099880417196144,-3.288829727389001,5.753439524022788,-1.8752458625661363,-0.9823515324160276,-1.1222966894793052),(0.8110134301050786,0.10305735724313725,-0.019183566058287527,1.478933303100145,-0.8948542269544303,-0.7185915708657821,-0.5378349211144934,0.0,2.2484776527244863,1.099880417196144,-3.288829727389001,5.753439524022788,-1.8752458625661363,-0.9823515324160276,-1.1222966894793052),(0.013571717295999042,-2.1401875522838942,1.5751388914372026,2.869365994906071,-2.263892397950471,-1.5905392928904198,-1.317250564711623,0.0,2.2484776527244863,1.099880417196144,-3.288829727389001,5.753439524022788,-1.8752458625661363,-0.9823515324160276,-1.1222966894793052),(-1.3815235147212976,-0.9616053368120304,2.8150588272277965,0.14759793530998425,-1.620992799677878,0.20786388505596268,-0.9816032789320823,0.0,2.2484776527244863,1.099880417196144,-3.288829727389001,5.753439524022788,-1.8752458625661363,-0.9823515324160276,-1.1222966894793052),(-0.11407654661743705,0.768404354463356,-0.3930175233254567,2.3015784648119375,-1.7211987426998967,0.45519975382978,-0.6156907430410832,1.0,2.2484776527244863,1.099880417196144,-3.288829727389001,5.753439524022788,-1.8752458625661363,-0.9823515324160276,-1.1222966894793052),(1.8478239086918133,1.5409911767774376,1.6994582902088935,-0.941221552716078,-0.5161849474607861,-1.0836831033224825,-0.4295520072868204,0.0,2.2484776527244863,1.099880417196144,-3.288829727389001,5.753439524022788,
DROP TABLE IF EXISTS test.model;
2019-02-15 23:38:13 +00:00
create table test.model engine = Memory as select LogisticRegressionState(0.005, 2, 2.0)(target, param1, param2, param3, param4, param5, param6, param7) as state from test.defaults;
2019-02-15 22:47:56 +00:00
with (select state from test.model) as model select evalMLMethod(model, predict1, predict2, predict3, predict4, predict5, predict6, predict7) from test.defaults;