Skip to content

Commit

Permalink
Merge pull request #121 from madgik/dev_BugFixes
Browse files Browse the repository at this point in the history
Dev bug fixes
  • Loading branch information
sofiakarb authored Jun 3, 2019
2 parents 6eb8251 + 0befd5f commit 22fe037
Show file tree
Hide file tree
Showing 9 changed files with 103 additions and 129 deletions.
2 changes: 1 addition & 1 deletion Deployment/settings.default.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/"}
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
requirevars 'defaultDB' 'type' 'outputformat';
requirevars 'defaultDB' 'sstype' 'outputformat';
attach database '%{defaultDB}' as defaultDB;

--var 'input_global_tbl' 'defaultDB.metadatatbl';
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
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';
var 'input_global_tbl' 'defaultDB.partialmetadatatbl' 'iterations_max_number';

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}' ;

Expand All @@ -28,8 +28,9 @@ 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';

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);
Expand Down
8 changes: 4 additions & 4 deletions Exareme-Docker/src/mip-algorithms/ANOVA/properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "iterative",
"parameters": [{
"name": "iterations_max_number",
"desc": "",
"desc": "Maximum number of iterations",
"type": "other",
"value": "",
"valueNotBlank": true,
Expand Down Expand Up @@ -33,13 +33,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.",
Expand Down
Original file line number Diff line number Diff line change
@@ -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 ="?";

Expand Down
40 changes: 20 additions & 20 deletions Exareme-Docker/src/mip-algorithms/unit_tests/test_ANOVA.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -15,7 +15,7 @@ def test_ANOVA_1():
{ "name": "iterations_max_number", "value": "20" },
{ "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" }
Expand Down Expand Up @@ -59,7 +59,7 @@ def test_ANOVA_2():
{ "name": "iterations_max_number", "value": "20" },
{ "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" }
Expand Down Expand Up @@ -107,7 +107,7 @@ def test_ANOVA_3():
{ "name": "iterations_max_number", "value": "20" },
{ "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" }
Expand Down Expand Up @@ -154,7 +154,7 @@ def test_ANOVA_4():
{ "name": "iterations_max_number", "value": "20" },
{ "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" }
Expand Down Expand Up @@ -197,7 +197,7 @@ def test_ANOVA_5():
{ "name": "iterations_max_number", "value": "20" },
{ "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" }
Expand Down Expand Up @@ -239,7 +239,7 @@ def test_ANOVA_6():
{ "name": "iterations_max_number", "value": "20" },
{ "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" }
Expand Down Expand Up @@ -282,7 +282,7 @@ def test_ANOVA_7():
{ "name": "iterations_max_number", "value": "20" },
{ "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" }
Expand Down Expand Up @@ -321,7 +321,7 @@ def test_ANOVA_8():
{ "name": "iterations_max_number", "value": "20" },
{ "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" }
Expand Down Expand Up @@ -355,7 +355,7 @@ def test_ANOVA_9():
{ "name": "iterations_max_number", "value": "20" },
{ "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" }
Expand Down Expand Up @@ -388,7 +388,7 @@ def test_ANOVA_10():
{ "name": "iterations_max_number", "value": "20" },
{ "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" }
Expand Down Expand Up @@ -425,7 +425,7 @@ def test_ANOVA_11():
{ "name": "iterations_max_number", "value": "20" },
{ "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" }
Expand Down Expand Up @@ -460,7 +460,7 @@ def test_ANOVA_12():
{ "name": "iterations_max_number", "value": "20" },
{ "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" }
Expand Down Expand Up @@ -505,7 +505,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" }
Expand Down Expand Up @@ -540,7 +540,7 @@ def test_ANOVA_14():
{ "name": "iterations_max_number", "value": "20" },
{ "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" }
Expand Down Expand Up @@ -580,7 +580,7 @@ def test_ANOVA_15():
{ "name": "iterations_max_number", "value": "20" },
{ "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" }
Expand Down Expand Up @@ -622,7 +622,7 @@ def test_ANOVA_16():
{ "name": "iterations_max_number", "value": "20" },
{ "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" }
Expand Down Expand Up @@ -666,7 +666,7 @@ def test_ANOVA_17():
{ "name": "iterations_max_number", "value": "20" },
{ "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" }
Expand Down Expand Up @@ -705,7 +705,7 @@ def test_ANOVA_17():

def test_ANOVA_Privacy():
"""
"""

logging.info("---------- TEST : Algorithms for Privacy Error")
Expand All @@ -714,7 +714,7 @@ def test_ANOVA_Privacy():
{ "name": "iterations_max_number", "value": "20" },
{ "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" }
Expand Down
Loading

0 comments on commit 22fe037

Please sign in to comment.