Skip to content

Commit

Permalink
added dMethods to dependency testing
Browse files Browse the repository at this point in the history
  • Loading branch information
ArunGaonkar committed Jun 23, 2022
1 parent 0e89aaf commit e261cb9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions Probability.ecl
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ EXPORT Probability(DATASET(NumericField) ds, SET OF STRING varNames) := MODULE
* Values less than .5 indicate probable independence.
* Values greater than .5 indicate probable dependence
*/
EXPORT DATASET(NumericField) Dependence(DATASET(ProbQuery) queries) := FUNCTION
EXPORT DATASET(NumericField) Dependence(DATASET(ProbQuery) queries, STRING dMethod='prob') := FUNCTION
queries_D := DISTRIBUTE(queries, id);
deps := ProbSpace.Dependence(queries_D, PS);
deps := ProbSpace.Dependence(queries_D, dMethod, PS);
deps_S := SORT(deps, id);
RETURN deps_S;
END;
Expand All @@ -125,9 +125,9 @@ EXPORT Probability(DATASET(NumericField) ds, SET OF STRING varNames) := MODULE
* targets are most likely independent. 0 indicates probable dependence.
*
*/
EXPORT DATASET(NumericField) isIndependent(DATASET(ProbQuery) queries) := FUNCTION
EXPORT DATASET(NumericField) isIndependent(DATASET(ProbQuery) queries, STRING dMethod='prob') := FUNCTION
queries_D := DISTRIBUTE(queries, id);
deps := ProbSpace.Dependence(queries_D, PS);
deps := ProbSpace.Dependence(queries_D, dMethod, PS);
deps_B := PROJECT(deps, TRANSFORM(RECORDOF(LEFT),
SELF.value := IF(LEFT.value > .5, 0, 1),
SELF := LEFT), LOCAL);
Expand Down
4 changes: 2 additions & 2 deletions internal/ProbSpace.ecl
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ EXPORT ProbSpace := MODULE
*
*/

EXPORT STREAMED DATASET(NumericField) Dependence(STREAMED DATASET(ProbQuery) queries, UNSIGNED ps) :=
EXPORT STREAMED DATASET(NumericField) Dependence(STREAMED DATASET(ProbQuery) queries, STRING dmethod, UNSIGNED ps) :=
EMBED(Python: globalscope(globalScope), persist('query'), activity)
assert 'PS' in globals(), 'ProbSpace.Dependence: PS is not initialized.'
try:
Expand All @@ -247,7 +247,7 @@ EXPORT ProbSpace := MODULE
else:
condition = cVar
conditions.append(condition)
result = PS.dependence(v1, v2, conditions)
result = PS.dependence(v1, v2, conditions, dMethod=dmethod)
results.append((1, id, 1, result))
return results
except:
Expand Down

0 comments on commit e261cb9

Please sign in to comment.