From e261cb98b948abe58ca4eceb3a253e7a007238ed Mon Sep 17 00:00:00 2001 From: Arun Gaonkar Date: Thu, 23 Jun 2022 14:52:59 -0400 Subject: [PATCH] added dMethods to dependency testing --- Probability.ecl | 8 ++++---- internal/ProbSpace.ecl | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Probability.ecl b/Probability.ecl index b46bc8b..52f09f1 100644 --- a/Probability.ecl +++ b/Probability.ecl @@ -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; @@ -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); diff --git a/internal/ProbSpace.ecl b/internal/ProbSpace.ecl index 9713dbd..1e809c1 100644 --- a/internal/ProbSpace.ecl +++ b/internal/ProbSpace.ecl @@ -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: @@ -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: