From e29bbf2a42ba2e39c2a0ef40571d0bfc825827e4 Mon Sep 17 00:00:00 2001 From: ezacharia Date: Mon, 3 Jun 2019 12:29:53 +0300 Subject: [PATCH 1/3] anova --- .../mip-algorithms/ANOVA/finalize/1/global.template.sql | 4 ++-- .../src/mip-algorithms/ANOVA/init/1/global.template.sql | 6 +++--- Exareme-Docker/src/mip-algorithms/ANOVA/properties.json | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Exareme-Docker/src/mip-algorithms/ANOVA/finalize/1/global.template.sql b/Exareme-Docker/src/mip-algorithms/ANOVA/finalize/1/global.template.sql index 9657a869d..09501850d 100644 --- a/Exareme-Docker/src/mip-algorithms/ANOVA/finalize/1/global.template.sql +++ b/Exareme-Docker/src/mip-algorithms/ANOVA/finalize/1/global.template.sql @@ -1,4 +1,4 @@ -requirevars 'defaultDB' 'type' 'outputformat'; +requirevars 'defaultDB' 'sstype' 'outputformat'; attach database '%{defaultDB}' as defaultDB; --var 'input_global_tbl' 'defaultDB.metadatatbl'; @@ -8,7 +8,7 @@ var 'metadata' from select jgroup(code,enumerations) from (select code ,enumerat drop table if exists defaultDB.sumofsquares; create table defaultDB.sumofsquares as -select sumofsquares(no,formula,sst,ssregs,sse,%{type}) from defaultDB.globalAnovatbl; +select sumofsquares(no,formula,sst,ssregs,sse,%{sstype}) from defaultDB.globalAnovatbl; var 'a' from select max(no) from defaultDB.sumofsquares; insert into defaultDB.sumofsquares diff --git a/Exareme-Docker/src/mip-algorithms/ANOVA/init/1/global.template.sql b/Exareme-Docker/src/mip-algorithms/ANOVA/init/1/global.template.sql index c670490e8..dd3e08216 100644 --- a/Exareme-Docker/src/mip-algorithms/ANOVA/init/1/global.template.sql +++ b/Exareme-Docker/src/mip-algorithms/ANOVA/init/1/global.template.sql @@ -1,4 +1,4 @@ -requirevars 'defaultDB' 'input_global_tbl' 'dataset' 'x' 'y' 'type' 'outputformat'; +requirevars 'defaultDB' 'input_global_tbl' 'dataset' 'x' 'y' 'sstype' 'outputformat'; attach database '%{defaultDB}' as defaultDB; var 'input_global_tbl' 'defaultDB.partialmetadatatbl'; @@ -7,7 +7,7 @@ drop table if exists defaultDB.algorithmparameters; --used for testing !!! create table defaultDB.algorithmparameters (name,val); insert into defaultDB.algorithmparameters select 'x' , '%{x}' ; insert into defaultDB.algorithmparameters select 'y' , '%{y}' ; -insert into defaultDB.algorithmparameters select 'type' , '%{type}' ; +insert into defaultDB.algorithmparameters select 'type' , '%{sstype}' ; insert into defaultDB.algorithmparameters select 'outputformat' , '%{outputformat}' ; insert into defaultDB.algorithmparameters select 'dataset' , '%{dataset}' ; @@ -28,7 +28,7 @@ insert into defaultDB.metadatatbl select distinct code, categorical,enumerations drop table if exists defaultDB.globalAnovatbl; create table defaultDB.globalAnovatbl (no int,formula text, sst real, ssregs real, sse real); insert into defaultDB.globalAnovatbl -select * from (select create_simplified_formulas('%{x}',%{type}), null ,null, null) ;--where formula!='intercept'; +select * from (select create_simplified_formulas('%{x}',%{sstype}), null ,null, null) ;--where formula!='intercept'; drop table if exists globalresult; diff --git a/Exareme-Docker/src/mip-algorithms/ANOVA/properties.json b/Exareme-Docker/src/mip-algorithms/ANOVA/properties.json index 939fa0dd9..71bfcd5de 100644 --- a/Exareme-Docker/src/mip-algorithms/ANOVA/properties.json +++ b/Exareme-Docker/src/mip-algorithms/ANOVA/properties.json @@ -4,7 +4,7 @@ "type": "iterative", "parameters": [{ "name": "iterations_max_number", - "desc": "", + "desc": "Maximum number of iterations", "type": "other", "value": "", "valueNotBlank": true, @@ -41,13 +41,13 @@ "valueMultiple": false, "valueType": "string" }, { - "name": "type", - "desc": "It contains the names of one or more datasets, in which the algorithm will be executed. It cannot be empty.", + "name": "sstype", + "desc": "Type of sum of squares to use. It can be 1 or 2 or 3.", "type": "other", "value": "2", "valueNotBlank": true, "valueMultiple": true, - "valueType": "string" + "valueType": "integer" }, { "name": "dataset", "desc": "It contains the names of one or more datasets, in which the algorithm will be executed. It cannot be empty.", From a37adc967132a5d31539d1c3b21a7308785ddf5c Mon Sep 17 00:00:00 2001 From: ezacharia Date: Mon, 3 Jun 2019 17:48:26 +0300 Subject: [PATCH 2/3] correct bugs --- .../src/functionslocal/row/errorchecking.py | 10 ++ .../ANOVA/init/1/global.template.sql | 3 +- .../ID3/finalize/1/global.template.sql | 4 +- .../mip-algorithms/unit_tests/test_ANOVA.py | 40 ++--- .../unit_tests/test_Histograms.py | 153 +++++++----------- .../src/mip-algorithms/unit_tests/test_ID3.py | 2 +- 6 files changed, 93 insertions(+), 119 deletions(-) diff --git a/Exareme-Docker/src/exareme/exareme-tools/madis/src/functionslocal/row/errorchecking.py b/Exareme-Docker/src/exareme/exareme-tools/madis/src/functionslocal/row/errorchecking.py index f11902c61..3de2bcc27 100644 --- a/Exareme-Docker/src/exareme/exareme-tools/madis/src/functionslocal/row/errorchecking.py +++ b/Exareme-Docker/src/exareme/exareme-tools/madis/src/functionslocal/row/errorchecking.py @@ -11,6 +11,16 @@ def privacychecking(*args): privacychecking.registered = True +def maxnumberofiterations_errorhandling(maxnumberofiterations,no): # For most of the iterative algorithms + if maxnumberofiterations< no: + raise functions.OperatorError("ExaremeError", "Please increase the max number of iterations") + else: + return "OK" + +maxnumberofiterations_errorhandling.registered = True + + + def kmeans_inputerrorchecking(centers,k): if (centers == '' and k == '') or (centers != '' and k != ''): raise functions.OperatorError("ExaremeError", "Only one of the following two parameters should be empty/have value: Centers or k") diff --git a/Exareme-Docker/src/mip-algorithms/ANOVA/init/1/global.template.sql b/Exareme-Docker/src/mip-algorithms/ANOVA/init/1/global.template.sql index dd3e08216..3dbe161a7 100644 --- a/Exareme-Docker/src/mip-algorithms/ANOVA/init/1/global.template.sql +++ b/Exareme-Docker/src/mip-algorithms/ANOVA/init/1/global.template.sql @@ -1,7 +1,7 @@ requirevars 'defaultDB' 'input_global_tbl' 'dataset' 'x' 'y' 'sstype' 'outputformat'; attach database '%{defaultDB}' as defaultDB; -var 'input_global_tbl' 'defaultDB.partialmetadatatbl'; +var 'input_global_tbl' 'defaultDB.partialmetadatatbl' 'iterations_max_number'; drop table if exists defaultDB.algorithmparameters; --used for testing !!! create table defaultDB.algorithmparameters (name,val); @@ -30,6 +30,7 @@ create table defaultDB.globalAnovatbl (no int,formula text, sst real, ssregs rea insert into defaultDB.globalAnovatbl select * from (select create_simplified_formulas('%{x}',%{sstype}), null ,null, null) ;--where formula!='intercept'; +var 'EH_IterationsMaxNumber' from select maxnumberofiterations_errorhandling(%{iterations_max_number},no) from (select count(*) as no from defaultDB.globalAnovatbl); drop table if exists globalresult; create table globalresult (tablename text,no int,formula text, sst real, ssregs real, sse real,code text, categorical int, enumerations text, referencevalue text); diff --git a/Exareme-Docker/src/mip-algorithms/ID3/finalize/1/global.template.sql b/Exareme-Docker/src/mip-algorithms/ID3/finalize/1/global.template.sql index 4c18802d0..3092ddeaa 100644 --- a/Exareme-Docker/src/mip-algorithms/ID3/finalize/1/global.template.sql +++ b/Exareme-Docker/src/mip-algorithms/ID3/finalize/1/global.template.sql @@ -1,6 +1,8 @@ -requirevars 'defaultDB' 'outputformat' ; +requirevars 'defaultDB' 'outputformat' 'iterations_max_number'; attach database '%{defaultDB}' as defaultDB; +var 'EH_IterationsMaxNumber' from select maxnumberofiterations_errorhandling(0,no) from (select count(nextnode) as no from defaultdb.globaltree where nextnode='?'); + update defaultDB.globaltree set nextnode = "" where nextnode ="-"; update defaultDB.globaltree set leafval = "" where leafval ="?"; diff --git a/Exareme-Docker/src/mip-algorithms/unit_tests/test_ANOVA.py b/Exareme-Docker/src/mip-algorithms/unit_tests/test_ANOVA.py index b30109588..a55e6c0a0 100644 --- a/Exareme-Docker/src/mip-algorithms/unit_tests/test_ANOVA.py +++ b/Exareme-Docker/src/mip-algorithms/unit_tests/test_ANOVA.py @@ -5,7 +5,7 @@ from decimal import * -endpointUrl='http://88.197.53.100:9090/mining/query/ANOVA' +endpointUrl='http://localhost:9090/mining/query/ANOVA' def test_ANOVA_1(): @@ -16,7 +16,7 @@ def test_ANOVA_1(): { "name": "iterations_condition_query_provided", "value": "true" }, { "name": "x", "value": "ANOVA_var_I1*ANOVA_var_I2*ANOVA_var_I3" }, { "name": "y", "value": "ANOVA_var_D" }, - { "name": "type", "value": "1" }, + { "name": "sstype", "value": "1" }, { "name": "dataset", "value": "ANOVA_Balanced_with_inter_V1V2" }, { "name": "filter", "value": "" }, { "name": "outputformat", "value": "pfa" } @@ -61,7 +61,7 @@ def test_ANOVA_2(): { "name": "iterations_condition_query_provided", "value": "true" }, { "name": "x", "value": "ANOVA_var_I1*ANOVA_var_I2*ANOVA_var_I3" }, { "name": "y", "value": "ANOVA_var_D" }, - { "name": "type", "value": "2" }, + { "name": "sstype", "value": "2" }, { "name": "dataset", "value": "ANOVA_Balanced_with_inter_V1V2" }, { "name": "filter", "value": "" }, { "name": "outputformat", "value": "pfa" } @@ -110,7 +110,7 @@ def test_ANOVA_3(): { "name": "iterations_condition_query_provided", "value": "true" }, { "name": "x", "value": "ANOVA_var_I1*ANOVA_var_I2*ANOVA_var_I3" }, { "name": "y", "value": "ANOVA_var_D" }, - { "name": "type", "value": "3" }, + { "name": "sstype", "value": "3" }, { "name": "dataset", "value": "ANOVA_Balanced_with_inter_V1V2" }, { "name": "filter", "value": "" }, { "name": "outputformat", "value": "pfa" } @@ -158,7 +158,7 @@ def test_ANOVA_4(): { "name": "iterations_condition_query_provided", "value": "true" }, { "name": "x", "value": "ANOVA_var_I1*ANOVA_var_I2*ANOVA_var_I3" }, { "name": "y", "value": "ANOVA_var_D" }, - { "name": "type", "value": "1" }, + { "name": "sstype", "value": "1" }, { "name": "dataset", "value": "ANOVA_UnBalanced_with_inter_V1V2" }, { "name": "filter", "value": "" }, { "name": "outputformat", "value": "pfa" } @@ -202,7 +202,7 @@ def test_ANOVA_5(): { "name": "iterations_condition_query_provided", "value": "true" }, { "name": "x", "value": "ANOVA_var_I1*ANOVA_var_I2*ANOVA_var_I3" }, { "name": "y", "value": "ANOVA_var_D" }, - { "name": "type", "value": "2" }, + { "name": "sstype", "value": "2" }, { "name": "dataset", "value": "ANOVA_UnBalanced_with_inter_V1V2" }, { "name": "filter", "value": "" }, { "name": "outputformat", "value": "pfa" } @@ -245,7 +245,7 @@ def test_ANOVA_6(): { "name": "iterations_condition_query_provided", "value": "true" }, { "name": "x", "value": "ANOVA_var_I1*ANOVA_var_I2*ANOVA_var_I3" }, { "name": "y", "value": "ANOVA_var_D" }, - { "name": "type", "value": "3" }, + { "name": "sstype", "value": "3" }, { "name": "dataset", "value": "ANOVA_UnBalanced_with_inter_V1V2" }, { "name": "filter", "value": "" }, { "name": "outputformat", "value": "pfa" } @@ -289,7 +289,7 @@ def test_ANOVA_7(): { "name": "iterations_condition_query_provided", "value": "true" }, { "name": "x", "value": "ANOVA_var_I1+ANOVA_var_I2+ANOVA_var_I3" }, { "name": "y", "value": "ANOVA_var_D" }, - { "name": "type", "value": "3" }, + { "name": "sstype", "value": "3" }, { "name": "dataset", "value": "ANOVA_UnBalanced_with_inter_V1V2" }, { "name": "filter", "value": "" }, { "name": "outputformat", "value": "pfa" } @@ -329,7 +329,7 @@ def test_ANOVA_8(): { "name": "iterations_condition_query_provided", "value": "true" }, { "name": "x", "value": "ANOVA_alzheimerbroadcategory+ANOVA_gender" }, { "name": "y", "value": "ANOVA_lefthippocampus" }, - { "name": "type", "value": "3" }, + { "name": "sstype", "value": "3" }, { "name": "dataset", "value": "ANOVA_dataset1,ANOVA_dataset2,ANOVA_dataset3" }, { "name": "filter", "value": "" }, { "name": "outputformat", "value": "pfa" } @@ -364,7 +364,7 @@ def test_ANOVA_9(): { "name": "iterations_condition_query_provided", "value": "true" }, { "name": "x", "value": "ANOVA_alzheimerbroadcategory+ANOVA_gender" }, { "name": "y", "value": "ANOVA_lefthippocampus" }, - { "name": "type", "value": "2" }, + { "name": "sstype", "value": "2" }, { "name": "dataset", "value": "ANOVA_dataset1,ANOVA_dataset2,ANOVA_dataset3" }, { "name": "filter", "value": "" }, { "name": "outputformat", "value": "pfa" } @@ -398,7 +398,7 @@ def test_ANOVA_10(): { "name": "iterations_condition_query_provided", "value": "true" }, { "name": "x", "value": "ANOVA_alzheimerbroadcategory*ANOVA_gender" }, { "name": "y", "value": "ANOVA_lefthippocampus" }, - { "name": "type", "value": "3" }, + { "name": "sstype", "value": "3" }, { "name": "dataset", "value": "ANOVA_dataset1,ANOVA_dataset2,ANOVA_dataset3" }, { "name": "filter", "value": "" }, { "name": "outputformat", "value": "pfa" } @@ -436,7 +436,7 @@ def test_ANOVA_11(): { "name": "iterations_condition_query_provided", "value": "true" }, { "name": "x", "value": "ANOVA_alzheimerbroadcategory*ANOVA_gender" }, { "name": "y", "value": "ANOVA_lefthippocampus" }, - { "name": "type", "value": "2" }, + { "name": "sstype", "value": "2" }, { "name": "dataset", "value": "ANOVA_dataset1,ANOVA_dataset2,ANOVA_dataset3" }, { "name": "filter", "value": "" }, { "name": "outputformat", "value": "pfa" } @@ -472,7 +472,7 @@ def test_ANOVA_12(): { "name": "iterations_condition_query_provided", "value": "true" }, { "name": "x", "value": "ANOVA_alzheimerbroadcategory+ANOVA_gender+ANOVA_agegroup" }, { "name": "y", "value": "ANOVA_lefthippocampus" }, - { "name": "type", "value": "3" }, + { "name": "sstype", "value": "3" }, { "name": "dataset", "value": "ANOVA_dataset1,ANOVA_dataset2,ANOVA_dataset3" }, { "name": "filter", "value": "" }, { "name": "outputformat", "value": "pfa" } @@ -517,7 +517,7 @@ def test_ANOVA_13(): { "name": "iterations_condition_query_provided", "value": "true" }, { "name": "x", "value": "ANOVA_alzheimerbroadcategory+ANOVA_gender+ANOVA_agegroup" }, { "name": "y", "value": "ANOVA_lefthippocampus" }, - { "name": "type", "value": "2" }, + { "name": "sstype", "value": "2" }, { "name": "dataset", "value": "ANOVA_dataset1,ANOVA_dataset2,ANOVA_dataset3" }, { "name": "filter", "value": "" }, { "name": "outputformat", "value": "pfa" } @@ -553,7 +553,7 @@ def test_ANOVA_14(): { "name": "iterations_condition_query_provided", "value": "true" }, { "name": "x", "value": "ANOVA_alzheimerbroadcategory*ANOVA_gender+ANOVA_agegroup" }, { "name": "y", "value": "ANOVA_lefthippocampus" }, - { "name": "type", "value": "3" }, + { "name": "sstype", "value": "3" }, { "name": "dataset", "value": "ANOVA_dataset1,ANOVA_dataset2,ANOVA_dataset3" }, { "name": "filter", "value": "" }, { "name": "outputformat", "value": "pfa" } @@ -594,7 +594,7 @@ def test_ANOVA_15(): { "name": "iterations_condition_query_provided", "value": "true" }, { "name": "x", "value": "ANOVA_alzheimerbroadcategory*ANOVA_gender+ANOVA_agegroup" }, { "name": "y", "value": "ANOVA_lefthippocampus" }, - { "name": "type", "value": "2" }, + { "name": "sstype", "value": "2" }, { "name": "dataset", "value": "ANOVA_dataset1,ANOVA_dataset2,ANOVA_dataset3" }, { "name": "filter", "value": "" }, { "name": "outputformat", "value": "pfa" } @@ -637,7 +637,7 @@ def test_ANOVA_16(): { "name": "iterations_condition_query_provided", "value": "true" }, { "name": "x", "value": "ANOVA_alzheimerbroadcategory*ANOVA_gender*ANOVA_agegroup" }, { "name": "y", "value": "ANOVA_lefthippocampus" }, - { "name": "type", "value": "3" }, + { "name": "sstype", "value": "3" }, { "name": "dataset", "value": "ANOVA_dataset1,ANOVA_dataset2,ANOVA_dataset3" }, { "name": "filter", "value": "" }, { "name": "outputformat", "value": "pfa" } @@ -682,7 +682,7 @@ def test_ANOVA_17(): { "name": "iterations_condition_query_provided", "value": "true" }, { "name": "x", "value": "ANOVA_alzheimerbroadcategory*ANOVA_gender*ANOVA_agegroup" }, { "name": "y", "value": "ANOVA_lefthippocampus" }, - { "name": "type", "value": "2" }, + { "name": "sstype", "value": "2" }, { "name": "dataset", "value": "ANOVA_dataset1,ANOVA_dataset2,ANOVA_dataset3" }, { "name": "filter", "value": "" }, { "name": "outputformat", "value": "pfa" } @@ -721,7 +721,7 @@ def test_ANOVA_17(): def test_ANOVA_Privacy(): """ - + """ logging.info("---------- TEST : Algorithms for Privacy Error") @@ -731,7 +731,7 @@ def test_ANOVA_Privacy(): { "name": "iterations_condition_query_provided", "value": "true" }, { "name": "x", "value": "ANOVA_var_I1*ANOVA_var_I2*ANOVA_var_I3" }, { "name": "y", "value": "ANOVA_var_D" }, - { "name": "type", "value": "1" }, + { "name": "sstype", "value": "1" }, { "name": "dataset", "value": "adni_9rows" }, { "name": "filter", "value": "" }, { "name": "outputformat", "value": "pfa" } diff --git a/Exareme-Docker/src/mip-algorithms/unit_tests/test_Histograms.py b/Exareme-Docker/src/mip-algorithms/unit_tests/test_Histograms.py index ed76dc5d0..de1d0a155 100644 --- a/Exareme-Docker/src/mip-algorithms/unit_tests/test_Histograms.py +++ b/Exareme-Docker/src/mip-algorithms/unit_tests/test_Histograms.py @@ -13,7 +13,7 @@ def test_Histogram_1(): data = [{ "name": "x", "value": "rightententorhinalarea"}, {"name": "y", "value": ""}, - {"name": "bins", "value": "50"}, + {"name": "bins", "value": "35"}, {"name": "dataset", "value": "desd-synthdata"}, {"name": "filter", "value": ""}] @@ -24,32 +24,20 @@ def test_Histogram_1(): ''' > sprintf("%0.7s - %0.7s",result_H0$xmax,result_H0$xmin) - [1] "0.38579 - 0.34445" "0.42714 - 0.38579" "0.46848 - 0.42714" "0.50983 - 0.46848" "0.55117 - 0.50983" "0.59252 - 0.55117" - [7] "0.63386 - 0.59252" "0.67521 - 0.63386" "0.71655 - 0.67521" "0.7579 - 0.71655" "0.79924 - 0.7579" "0.84059 - 0.79924" - [13] "0.88193 - 0.84059" "0.92328 - 0.88193" "0.96462 - 0.92328" "1.00597 - 0.96462" "1.04731 - 1.00597" "1.08866 - 1.04731" - [19] "1.13000 - 1.08866" "1.17135 - 1.13000" "1.21269 - 1.17135" "1.25404 - 1.21269" "1.29538 - 1.25404" "1.33673 - 1.29538" - [25] "1.37807 - 1.33673" "1.41942 - 1.37807" "1.46076 - 1.41942" "1.50211 - 1.46076" "1.54345 - 1.50211" "1.5848 - 1.54345" - [31] "1.62614 - 1.5848" "1.66749 - 1.62614" "1.70883 - 1.66749" "1.75018 - 1.70883" "1.79152 - 1.75018" "1.83287 - 1.79152" - [37] "1.87421 - 1.83287" "1.91556 - 1.87421" "1.95690 - 1.91556" "1.99825 - 1.95690" "2.03959 - 1.99825" "2.08094 - 2.03959" - [43] "2.12228 - 2.08094" "2.16363 - 2.12228" "2.20497 - 2.16363" "2.24632 - 2.20497" "2.28766 - 2.24632" "2.32901 - 2.28766" - [49] "2.37035 - 2.32901" "2.4117 - 2.37035" + [1] "0.40351 - 0.34445" "0.46257 - 0.40351" "0.52164 - 0.46257" "0.58070 - 0.52164" "0.63977 - 0.58070" "0.69883 - 0.63977" "0.7579 - 0.69883" "0.81696 - 0.7579" "0.87602 - 0.81696" "0.93509 - 0.87602" +[11] "0.99415 - 0.93509" "1.05322 - 0.99415" "1.11228 - 1.05322" "1.17135 - 1.11228" "1.23041 - 1.17135" "1.28947 - 1.23041" "1.34854 - 1.28947" "1.40760 - 1.34854" "1.46667 - 1.40760" "1.52573 - 1.46667" +[21] "1.5848 - 1.52573" "1.64386 - 1.5848" "1.70292 - 1.64386" "1.76199 - 1.70292" "1.82105 - 1.76199" "1.88012 - 1.82105" "1.93918 - 1.88012" "1.99825 - 1.93918" "2.05731 - 1.99825" "2.11637 - 2.05731" +[31] "2.17544 - 2.11637" "2.23450 - 2.17544" "2.29357 - 2.23450" "2.35263 - 2.29357" "2.4117 - 2.35263" > result_H0$y - [1] 3 0 0 0 0 0 0 0 0 0 0 0 3 1 4 6 8 0 5 7 21 10 40 21 25 65 67 70 44 74 80 48 65 51 54 36 9 42 17 20 - [41] 5 3 6 5 0 0 0 0 0 5 + [1] 3 0 0 0 0 0 0 0 3 1 10 8 3 9 24 43 29 61 107 82 91 104 81 61 79 31 42 24 6 8 5 0 0 0 5 ''' - corr_bins = [ - "0.38579 - 0.34445","0.42714 - 0.38579","0.46848 - 0.42714","0.50983 - 0.46848","0.55117 - 0.50983","0.59252 - 0.55117", - "0.63386 - 0.59252","0.67521 - 0.63386","0.71655 - 0.67521","0.7579 - 0.71655","0.79924 - 0.7579","0.84059 - 0.79924", - "0.88193 - 0.84059","0.92328 - 0.88193","0.96462 - 0.92328","1.00597 - 0.96462","1.04731 - 1.00597","1.08866 - 1.04731", - "1.13000 - 1.08866","1.17135 - 1.13000","1.21269 - 1.17135","1.25404 - 1.21269","1.29538 - 1.25404","1.33673 - 1.29538", - "1.37807 - 1.33673","1.41942 - 1.37807","1.46076 - 1.41942","1.50211 - 1.46076","1.54345 - 1.50211","1.5848 - 1.54345", - "1.62614 - 1.5848" , "1.66749 - 1.62614","1.70883 - 1.66749","1.75018 - 1.70883","1.79152 - 1.75018","1.83287 - 1.79152", - "1.87421 - 1.83287","1.91556 - 1.87421","1.95690 - 1.91556","1.99825 - 1.95690","2.03959 - 1.99825","2.08094 - 2.03959", - "2.12228 - 2.08094","2.16363 - 2.12228","2.20497 - 2.16363","2.24632 - 2.20497","2.28766 - 2.24632","2.32901 - 2.28766", - "2.37035 - 2.32901","2.4117 - 2.37035"] + corr_bins = [ "0.40351 - 0.34445" ,"0.46257 - 0.40351", "0.52164 - 0.46257", "0.58070 - 0.52164", "0.63977 - 0.58070" ,"0.69883 - 0.63977", "0.7579 - 0.69883", "0.81696 - 0.7579", "0.87602 - 0.81696" ,"0.93509 - 0.87602", + "0.99415 - 0.93509", "1.05322 - 0.99415", "1.11228 - 1.05322", "1.17135 - 1.11228", "1.23041 - 1.17135", "1.28947 - 1.23041", "1.34854 - 1.28947", "1.40760 - 1.34854", "1.46667 - 1.40760", "1.52573 - 1.46667", + "1.5848 - 1.52573" , "1.64386 - 1.5848" , "1.70292 - 1.64386", "1.76199 - 1.70292", "1.82105 - 1.76199", "1.88012 - 1.82105", "1.93918 - 1.88012", "1.99825 - 1.93918", "2.05731 - 1.99825", "2.11637 - 2.05731", + "2.17544 - 2.11637", "2.23450 - 2.17544" ,"2.29357 - 2.23450", "2.35263 - 2.29357", "2.4117 - 2.35263"] - corr_counts =[ {'name': 'All', 'data': [3,0,0,0,0,0,0,0,0,0,0,0,3,1,4,6,8,0,5,7,21,10,40,21,25,65,67,70,44,74,80,48,65,51,54,36, 9,42,17,20,5,3,6,5,0,0,0,0,0,5]}] + corr_counts =[ {'name': 'All', 'data': [ 3 , 0 , 0 , 0 , 0, 0 , 0 , 0 , 3 , 1 ,10 , 8 , 3, 9 ,24 , 43 , 29, 61, 107 , 82 , 91, 104, 81 ,61 , 79 , 31 , 42 ,24 , 6 ,8 , 5 , 0 , 0 , 0 , 5]}] check_rangesofbins(result['xAxis']['categories'],corr_bins) check_valuesofbins(result['series'],corr_counts,10) @@ -61,7 +49,7 @@ def test_Histogram_2(): data = [{ "name": "x", "value": "rightententorhinalarea"}, {"name": "y", "value": "gender"}, - {"name": "bins", "value": "50"}, + {"name": "bins", "value": "24"}, {"name": "dataset", "value": "desd-synthdata"}, {"name": "filter", "value": ""}] @@ -73,37 +61,25 @@ def test_Histogram_2(): ''' ##Test 2 > temp$y_M - [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 5 13 6 6 23 29 32 19 40 49 19 33 26 34 19 7 34 12 15 - [41] 4 3 6 3 0 0 0 0 0 5 + 0 0 0 0 0 0 0 0 0 3 19 12 55 51 91 61 56 29 42 11 11 0 0 5 > temp$y_W - [1] 3 0 0 0 0 0 0 0 0 0 0 0 3 1 4 6 8 0 5 5 19 5 27 15 19 42 38 38 25 34 31 29 32 25 20 17 2 8 5 5 - [41] 1 0 0 2 0 0 0 0 0 0 + 3 0 0 0 0 3 5 14 4 19 38 34 83 62 65 72 42 12 14 2 2 0 0 0 > sprintf("%0.7s - %0.7s",temp2$xmax,temp2$xmin) - [1] "0.38579 - 0.34445" "0.42714 - 0.38579" "0.46848 - 0.42714" "0.50983 - 0.46848" "0.55117 - 0.50983" "0.59252 - 0.55117" - [7] "0.63386 - 0.59252" "0.67521 - 0.63386" "0.71655 - 0.67521" "0.7579 - 0.71655" "0.79924 - 0.7579" "0.84059 - 0.79924" - [13] "0.88193 - 0.84059" "0.92328 - 0.88193" "0.96462 - 0.92328" "1.00597 - 0.96462" "1.04731 - 1.00597" "1.08866 - 1.04731" - [19] "1.13000 - 1.08866" "1.17135 - 1.13000" "1.21269 - 1.17135" "1.25404 - 1.21269" "1.29538 - 1.25404" "1.33673 - 1.29538" - [25] "1.37807 - 1.33673" "1.41942 - 1.37807" "1.46076 - 1.41942" "1.50211 - 1.46076" "1.54345 - 1.50211" "1.5848 - 1.54345" - [31] "1.62614 - 1.5848" "1.66749 - 1.62614" "1.70883 - 1.66749" "1.75018 - 1.70883" "1.79152 - 1.75018" "1.83287 - 1.79152" - [37] "1.87421 - 1.83287" "1.91556 - 1.87421" "1.95690 - 1.91556" "1.99825 - 1.95690" "2.03959 - 1.99825" "2.08094 - 2.03959" - [43] "2.12228 - 2.08094" "2.16363 - 2.12228" "2.20497 - 2.16363" "2.24632 - 2.20497" "2.28766 - 2.24632" "2.32901 - 2.28766" - [49] "2.37035 - 2.32901" "2.4117 - 2.37035" + [1] "0.43058 - 0.34445" "0.51672 - 0.43058" "0.60285 - 0.51672" "0.68899 - 0.60285" "0.77512 - 0.68899" "0.86126 - 0.77512" + [7] "0.94739 - 0.86126" "1.03353 - 0.94739" "1.11966 - 1.03353" "1.20580 - 1.11966" "1.29193 - 1.20580" "1.37807 - 1.29193" +[13] "1.46421 - 1.37807" "1.55034 - 1.46421" "1.63648 - 1.55034" "1.72261 - 1.63648" "1.80875 - 1.72261" "1.89488 - 1.80875" +[19] "1.98102 - 1.89488" "2.06715 - 1.98102" "2.15329 - 2.06715" "2.23942 - 2.15329" "2.32556 - 2.23942" "2.4117 - 2.32556" ''' - corr_bins = [ "0.38579 - 0.34445","0.42714 - 0.38579","0.46848 - 0.42714","0.50983 - 0.46848","0.55117 - 0.50983","0.59252 - 0.55117", - "0.63386 - 0.59252","0.67521 - 0.63386","0.71655 - 0.67521","0.7579 - 0.71655", "0.79924 - 0.7579" , "0.84059 - 0.79924", - "0.88193 - 0.84059","0.92328 - 0.88193","0.96462 - 0.92328","1.00597 - 0.96462","1.04731 - 1.00597","1.08866 - 1.04731", - "1.13000 - 1.08866","1.17135 - 1.13000","1.21269 - 1.17135","1.25404 - 1.21269","1.29538 - 1.25404","1.33673 - 1.29538", - "1.37807 - 1.33673","1.41942 - 1.37807","1.46076 - 1.41942","1.50211 - 1.46076","1.54345 - 1.50211","1.5848 - 1.54345" , - "1.62614 - 1.5848", "1.66749 - 1.62614","1.70883 - 1.66749","1.75018 - 1.70883","1.79152 - 1.75018","1.83287 - 1.79152", - "1.87421 - 1.83287","1.91556 - 1.87421","1.95690 - 1.91556","1.99825 - 1.95690","2.03959 - 1.99825","2.08094 - 2.03959", - "2.12228 - 2.08094","2.16363 - 2.12228","2.20497 - 2.16363","2.24632 - 2.20497","2.28766 - 2.24632","2.32901 - 2.28766", - "2.37035 - 2.32901","2.4117 - 2.37035"] + corr_bins = [ "0.43058 - 0.34445", "0.51672 - 0.43058", "0.60285 - 0.51672", "0.68899 - 0.60285", "0.77512 - 0.68899" ,"0.86126 - 0.77512", + "0.94739 - 0.86126", "1.03353 - 0.94739", "1.11966 - 1.03353" ,"1.20580 - 1.11966", "1.29193 - 1.20580", "1.37807 - 1.29193", + "1.46421 - 1.37807", "1.55034 - 1.46421" ,"1.63648 - 1.55034", "1.72261 - 1.63648", "1.80875 - 1.72261" ,"1.89488 - 1.80875", + "1.98102 - 1.89488", "2.06715 - 1.98102", "2.15329 - 2.06715", "2.23942 - 2.15329" ,"2.32556 - 2.23942", "2.4117 - 2.32556" ] - corr_counts =[ {'name': 'M', 'data': [ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,5,13,6,6,23,29,32,19,40,49,19,33,26,34,19,7,34,12,15,4,3,6,3,0,0,0,0,0,5]}, - {'name': 'F', 'data': [3,0,0,0,0,0,0,0,0,0,0,0,3,1,4,6,8,0,5,5,19,5,27,15,19,42,38,38,25,34,31,29,32,25,20,17,2,8,5,5,1,0,0,2,0,0,0,0,0,0]}] + corr_counts =[ {'name': 'M', 'data': [ 0 , 0 ,0 ,0 , 0, 0 , 0 , 0 , 0 , 3, 19, 12, 55, 51, 91, 61 ,56 ,29, 42 ,11, 11 ,0, 0 , 5]}, + {'name': 'F', 'data': [3 , 0, 0 , 0 , 0, 3, 5 ,14 , 4, 19, 38 ,34 ,83, 62, 65 ,72, 42 ,12, 14 , 2 , 2, 0 , 0 ,0]}] check_rangesofbins(result['xAxis']['categories'],corr_bins) check_valuesofbins(result['series'],corr_counts,10) @@ -114,7 +90,7 @@ def test_Histogram_3(): data = [{ "name": "x", "value": "rightententorhinalarea"}, {"name": "y", "value": "alzheimerbroadcategory"}, - {"name": "bins", "value": "30"}, + {"name": "bins", "value": "19"}, {"name": "dataset", "value": "desd-synthdata"}, {"name": "filter", "value": ""}] @@ -123,45 +99,28 @@ def test_Histogram_3(): result = json.loads(r.text) print (r.text) ''' - #AD - > result2$y - [1] 0 0 0 0 0 0 0 1 4 9 1 6 20 30 18 47 39 32 20 14 11 6 8 7 0 0 0 0 0 1 - > sprintf("%0.7s - %0.7s",result2$xmax,result2$xmin) - [1] "0.41335 - 0.34445" "0.48226 - 0.41335" "0.55117 - 0.48226" "0.62008 - 0.55117" "0.68899 - 0.62008" "0.7579 - 0.68899" - [7] "0.82680 - 0.7579" "0.89571 - 0.82680" "0.96462 - 0.89571" "1.03353 - 0.96462" "1.10244 - 1.03353" "1.17135 - 1.10244" - [13] "1.24025 - 1.17135" "1.30916 - 1.24025" "1.37807 - 1.30916" "1.44698 - 1.37807" "1.51589 - 1.44698" "1.5848 - 1.51589" - [19] "1.65370 - 1.5848" "1.72261 - 1.65370" "1.79152 - 1.72261" "1.86043 - 1.79152" "1.92934 - 1.86043" "1.99825 - 1.92934" - [25] "2.06715 - 1.99825" "2.13606 - 2.06715" "2.20497 - 2.13606" "2.27388 - 2.20497" "2.34279 - 2.27388" "2.4117 - 2.34279" - - #CN - > result2$y - [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 14 42 28 54 47 44 18 23 13 1 5 2 0 0 2 - > sprintf("%0.7s - %0.7s",result2$xmax,result2$xmin) - [1] "0.41335 - 0.34445" "0.48226 - 0.41335" "0.55117 - 0.48226" "0.62008 - 0.55117" "0.68899 - 0.62008" "0.7579 - 0.68899" - [7] "0.82680 - 0.7579" "0.89571 - 0.82680" "0.96462 - 0.89571" "1.03353 - 0.96462" "1.10244 - 1.03353" "1.17135 - 1.10244" - [13] "1.24025 - 1.17135" "1.30916 - 1.24025" "1.37807 - 1.30916" "1.44698 - 1.37807" "1.51589 - 1.44698" "1.5848 - 1.51589" - [19] "1.65370 - 1.5848" "1.72261 - 1.65370" "1.79152 - 1.72261" "1.86043 - 1.79152" "1.92934 - 1.86043" "1.99825 - 1.92934" - [25] "2.06715 - 1.99825" "2.13606 - 2.06715" "2.20497 - 2.13606" "2.27388 - 2.20497" "2.34279 - 2.27388" "2.4117 - 2.34279" - - #Other - > result2$y - [1] 1 0 0 0 0 0 0 0 0 3 0 4 5 10 9 28 13 15 12 12 10 5 8 4 2 4 0 0 0 1 + > result_H2$y_AD + [1] 0 0 0 0 1 8 7 24 32 56 55 44 15 16 13 2 0 0 1 + > result_H2$y_CN + [1] 0 0 0 0 0 0 0 0 0 13 54 73 67 47 31 5 6 0 2 + > result_H2$y_Other + [1] 1 0 0 0 0 2 2 7 13 26 25 24 13 16 8 5 3 0 1 + > sprintf("%0.7s - %0.7s",result2$xmax,result2$xmin) - [1] "0.41335 - 0.34445" "0.48226 - 0.41335" "0.55117 - 0.48226" "0.62008 - 0.55117" "0.68899 - 0.62008" "0.7579 - 0.68899" - [7] "0.82680 - 0.7579" "0.89571 - 0.82680" "0.96462 - 0.89571" "1.03353 - 0.96462" "1.10244 - 1.03353" "1.17135 - 1.10244" - [13] "1.24025 - 1.17135" "1.30916 - 1.24025" "1.37807 - 1.30916" "1.44698 - 1.37807" "1.51589 - 1.44698" "1.5848 - 1.51589" - [19] "1.65370 - 1.5848" "1.72261 - 1.65370" "1.79152 - 1.72261" "1.86043 - 1.79152" "1.92934 - 1.86043" "1.99825 - 1.92934" - [25] "2.06715 - 1.99825" "2.13606 - 2.06715" "2.20497 - 2.13606" "2.27388 - 2.20497" "2.34279 - 2.27388" "2.4117 - 2.34279" + [1] "0.45325 - 0.34445" "0.56205 - 0.45325" "0.67085 - 0.56205" "0.77966 - 0.67085" "0.88846 - 0.77966" "0.99726 - 0.88846" + [7] "1.10606 - 0.99726" "1.21487 - 1.10606" "1.32367 - 1.21487" "1.43247 - 1.32367" "1.54127 - 1.43247" "1.65008 - 1.54127" +[13] "1.75888 - 1.65008" "1.86768 - 1.75888" "1.97648 - 1.86768" "2.08529 - 1.97648" "2.19409 - 2.08529" "2.30289 - 2.19409" +[19] "2.4117 - 2.30289" + ''' - corr_bins = ["0.41335 - 0.34445","0.48226 - 0.41335","0.55117 - 0.48226","0.62008 - 0.55117","0.68899 - 0.62008","0.7579 - 0.68899" , - "0.82680 - 0.7579","0.89571 - 0.82680","0.96462 - 0.89571","1.03353 - 0.96462","1.10244 - 1.03353","1.17135 - 1.10244", - "1.24025 - 1.17135","1.30916 - 1.24025","1.37807 - 1.30916","1.44698 - 1.37807","1.51589 - 1.44698","1.5848 - 1.51589" , - "1.65370 - 1.5848","1.72261 - 1.65370","1.79152 - 1.72261","1.86043 - 1.79152","1.92934 - 1.86043","1.99825 - 1.92934", - "2.06715 - 1.99825","2.13606 - 2.06715","2.20497 - 2.13606","2.27388 - 2.20497","2.34279 - 2.27388","2.4117 - 2.34279" ] + corr_bins = [ "0.45325 - 0.34445" ,"0.56205 - 0.45325", "0.67085 - 0.56205" ,"0.77966 - 0.67085", "0.88846 - 0.77966", "0.99726 - 0.88846", + "1.10606 - 0.99726", "1.21487 - 1.10606", "1.32367 - 1.21487" ,"1.43247 - 1.32367" ,"1.54127 - 1.43247" ,"1.65008 - 1.54127", + "1.75888 - 1.65008" ,"1.86768 - 1.75888", "1.97648 - 1.86768", "2.08529 - 1.97648", "2.19409 - 2.08529", "2.30289 - 2.19409", + "2.4117 - 2.30289" ] - corr_counts =[ {'name': 'AD', 'data': [ 0,0,0,0,0,0,0,1,4,9,1,6,20,30,18,47,39,32,20,14,11,6,8,7,0,0,0,0,0,1]}, - {'name': 'CN', 'data': [ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,14,42,28,54,47,44,18,23,13,1,5,2,0,0,2]}, - {'name': 'Other', 'data': [ 1,0,0,0,0,0,0,0,0,3,0,4,5,10,9,28,13,15,12,12,10,5,8,4,2,4,0,0,0,1]}] + corr_counts =[ {'name': 'AD', 'data': [ 0, 0 , 0 , 0 , 1 , 8 , 7 ,24, 32, 56 ,55 ,44, 15, 16, 13 , 2 , 0, 0, 1]}, + {'name': 'CN', 'data': [ 0 ,0 , 0 , 0, 0 , 0 , 0, 0, 0, 13, 54, 73 ,67, 47, 31, 5 , 6 , 0 , 2]}, + {'name': 'Other', 'data': [ 1 , 0, 0, 0 , 0, 2, 2, 7, 13, 26, 25, 24 ,13, 16 , 8 , 5, 3 , 0 , 1]}] check_rangesofbins(result['xAxis']['categories'],corr_bins) @@ -177,21 +136,23 @@ def test_Histogram_4(): {"name": "y", "value": ""}, {"name": "bins", "value": ""}, {"name": "dataset", "value": "desd-synthdata"}, - {"name": "filter", "value": ""}] + {"name": "filter", "value": "{\"condition\": \"AND\", \"rules\": [{\"id\": \"rightententorhinalarea\",\"field\": \"rightententorhinalarea\",\"type\": \"double\", \"input\": \"number\", \"operator\": \"is_not_null\", \"value\": null}],\"valid\": true}"}] + headers = {'Content-type': 'application/json', "Accept": "text/plain"} r = requests.post(endpointUrl,data=json.dumps(data),headers=headers) result = json.loads(r.text) print (r.text) ''' - > layer_H3$count - [1] 330 298 149 - > layer_H3$group - [1] 1 2 3 - > + > result_H3$y_AD + [1] 274 + > result_H3$y_CN + [1] 298 + > result_H3$y_Other + [1] 146 ''' corr_bins = ["Other","AD","CN"] - corr_counts =[{'name': 'All', 'data': [149,330,298]}] + corr_counts =[{'name': 'All', 'data': [146,274,298]}] check_rangesofbinsDiscreteVariable(result['xAxis']['categories'],corr_bins) check_valuesofbins(result['series'],corr_counts,10) @@ -206,7 +167,7 @@ def test_Histogram_5(): {"name": "y", "value": "gender"}, {"name": "bins", "value": ""}, {"name": "dataset", "value": "desd-synthdata"}, - {"name": "filter", "value": ""}] + {"name": "filter", "value": "{\"condition\": \"AND\", \"rules\": [{\"id\": \"rightententorhinalarea\",\"field\": \"rightententorhinalarea\",\"type\": \"double\", \"input\": \"number\", \"operator\": \"is_not_null\", \"value\": null}],\"valid\": true}"}] headers = {'Content-type': 'application/json', "Accept": "text/plain"} r = requests.post(endpointUrl,data=json.dumps(data),headers=headers) @@ -215,12 +176,12 @@ def test_Histogram_5(): ''' y_W_AD y_M_AD y_W_CN y_M_CN y_W_Other y_M_Other -1 193 137 154 144 76 73 +1 161 113 154 144 73 73 ''' corr_bins = ["Other","AD","CN"] - corr_counts =[{'name': 'F', 'data': [76,193,154]}, - {'name': 'M', 'data': [73,137,144]}] + corr_counts =[{'name': 'F', 'data': [73,161,154]}, + {'name': 'M', 'data': [73,113,144]}] check_rangesofbinsDiscreteVariable(result['xAxis']['categories'],corr_bins) check_valuesofbins(result['series'],corr_counts,10) diff --git a/Exareme-Docker/src/mip-algorithms/unit_tests/test_ID3.py b/Exareme-Docker/src/mip-algorithms/unit_tests/test_ID3.py index 4ec4b300b..fda6e394a 100644 --- a/Exareme-Docker/src/mip-algorithms/unit_tests/test_ID3.py +++ b/Exareme-Docker/src/mip-algorithms/unit_tests/test_ID3.py @@ -3,7 +3,7 @@ import logging -endpointUrl='http://88.197.53.100:9090/mining/query/ID3' +endpointUrl='http://localhost:9090/mining/query/ID3' def test_ID3_1(): logging.info("---------- TEST : ID3 - Test using contact-lenses dataset ") From 0befd5f8876700557599f35a66e7f16238b79816 Mon Sep 17 00:00:00 2001 From: ezacharia Date: Mon, 3 Jun 2019 17:51:06 +0300 Subject: [PATCH 3/3] bugs --- Deployment/settings.default.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Deployment/settings.default.sh b/Deployment/settings.default.sh index d236fc793..83e3ce2d9 100755 --- a/Deployment/settings.default.sh +++ b/Deployment/settings.default.sh @@ -124,4 +124,4 @@ : ${DOCKER_DATASETS_FOLDER:="/root/exareme/datasets"} # Host dataset folder -: ${LOCAL_DATASETS_FOLDER:="/path/to/dataset/folder"} +: ${LOCAL_DATASETS_FOLDER:="/home/eleni/Desktop/HBP/"}