From 77b017d84531c7c87810316a6ce1af29e6d3af84 Mon Sep 17 00:00:00 2001 From: joaoloula Date: Tue, 8 Nov 2022 12:38:28 -0500 Subject: [PATCH 01/13] added logprob, breaking protocol --- .../inference/gpm/conditioned.cljc | 5 ++ src/inferenceql/inference/gpm/proto.cljc | 1 + .../inference/gpm/conditioned_test.cljc | 65 +++++++++++++++++++ 3 files changed, 71 insertions(+) diff --git a/src/inferenceql/inference/gpm/conditioned.cljc b/src/inferenceql/inference/gpm/conditioned.cljc index 6057f28..865b349 100644 --- a/src/inferenceql/inference/gpm/conditioned.cljc +++ b/src/inferenceql/inference/gpm/conditioned.cljc @@ -7,6 +7,11 @@ (let [merged-conditions (merge conditions logpdf-conditions)] (gpm.proto/logpdf gpm targets merged-conditions))) + gpm.proto/LogProb + (logprob [_ targets logprob-conditions] + (let [merged-conditions (merge conditions logprob-conditions)] + (gpm.proto/logprob gpm targets merged-conditions))) + (simulate [_ targets simulate-conditions] (let [merged-conditions (merge conditions simulate-conditions)] (gpm.proto/simulate gpm targets merged-conditions))) diff --git a/src/inferenceql/inference/gpm/proto.cljc b/src/inferenceql/inference/gpm/proto.cljc index c98706f..8322bac 100644 --- a/src/inferenceql/inference/gpm/proto.cljc +++ b/src/inferenceql/inference/gpm/proto.cljc @@ -3,6 +3,7 @@ (defprotocol GPM "A simple protocol for defining a GPM." (logpdf [this targets constraints]) + (logprob [this targets constraints]) (simulate [this targets constraints]) (mutual-information [this target-a target-b constraints n-samples])) diff --git a/test/inferenceql/inference/gpm/conditioned_test.cljc b/test/inferenceql/inference/gpm/conditioned_test.cljc index d4260fa..446bc0a 100644 --- a/test/inferenceql/inference/gpm/conditioned_test.cljc +++ b/test/inferenceql/inference/gpm/conditioned_test.cljc @@ -39,6 +39,23 @@ [:x :y] {:y 1} [:x :y] {:x 0 :y 1})) +(deftest logprob-targets + (are [targets conditions] + (let [model (reify gpm.proto/LogProb + (logprob [_ actual _] + actual)) + conditioned-model (conditioned/condition model conditions)] + (= targets (gpm/logprob conditioned-model targets conditions))) + [] {} + [:x] {} + [] {:x 0} + [:x] {:x 0} + [:x :y] {} + [] {:x 0} + [:x :y] {:x 0} + [:x :y] {:y 1} + [:x :y] {:x 0 :y 1})) + (deftest logpdf-conditions (are [condition-conditions conditions expected] (let [model (reify gpm.proto/GPM @@ -55,6 +72,22 @@ {:x 0 :z 2} {:y 1} {:x 0 :y 1 :z 2} {:x 0} {:y 1 :z 2} {:x 0 :y 1 :z 2})) +(deftest logprob-conditions + (are [condition-conditions conditions expected] + (let [model (reify gpm.proto/LogProb + (logprob [_ _ actual] + actual)) + conditioned-model (conditioned/condition model condition-conditions)] + (= expected (gpm/logprob conditioned-model [:x] conditions))) + {} {} {} + {} {:x 0} {:x 0} + {:x 0} {} {:x 0} + {:x 0} {:x 1} {:x 1} + {:x 0} {:y 1} {:x 0 :y 1} + {:y 1} {:x 0} {:x 0 :y 1} + {:x 0 :z 2} {:y 1} {:x 0 :y 1 :z 2} + {:x 0} {:y 1 :z 2} {:x 0 :y 1 :z 2})) + (deftest simulate-conditions (are [c1 c2 expected] (let [model (reify gpm.proto/GPM @@ -102,3 +135,35 @@ {:x 0} {:x 1} {} {:x 1} {:x 0} {} {:x 1} {:x 1} {} {:x 0} {:x 1} {:x 1})) + +(deftest logprob-condition + (are [c1 c2 expected] + (let [model (-> (reify gpm.proto/LogProb + (simulate [_ _ actual] + actual)) + (conditioned/condition c1))] + (= expected (gpm/simulate model [:x] c2))) + {} {} {} + {} {:x 0} {:x 0} + {:x 0} {} {:x 0} + {:x 0} {:x 1} {:x 1} + {:x 0} {:y 1} {:x 0 :y 1} + {:y 1} {:x 0} {:x 0 :y 1} + {:x 0 :z 2} {:y 1} {:x 0 :y 1 :z 2} + {:x 0} {:y 1 :z 2} {:x 0 :y 1 :z 2})) + +(deftest logprob-condition-twice + (are [c1 c2 c3 expected] + (let [model (-> (reify gpm.proto/LogProb + (simulate [_ _ actual] + actual)) + (conditioned/condition c1) + (conditioned/condition c2))] + (= expected (gpm/simulate model [:x] c3))) + {} {} {} {} + {:x 0} {} {} {:x 0} + {} {:x 0} {} {:x 0} + {} {} {:x 0} {:x 0} + {:x 0} {:x 1} {} {:x 1} + {:x 0} {} {:x 1} {:x 1} + {} {:x 0} {:x 1} {:x 1})) \ No newline at end of file From 2a96f4201e30b15a8ac4a83148b86b066f819ad6 Mon Sep 17 00:00:00 2001 From: joaoloula Date: Tue, 8 Nov 2022 12:45:16 -0500 Subject: [PATCH 02/13] put logprob after simulate --- src/inferenceql/inference/gpm/conditioned.cljc | 8 ++++---- src/inferenceql/inference/gpm/proto.cljc | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/inferenceql/inference/gpm/conditioned.cljc b/src/inferenceql/inference/gpm/conditioned.cljc index 865b349..4914adc 100644 --- a/src/inferenceql/inference/gpm/conditioned.cljc +++ b/src/inferenceql/inference/gpm/conditioned.cljc @@ -7,15 +7,15 @@ (let [merged-conditions (merge conditions logpdf-conditions)] (gpm.proto/logpdf gpm targets merged-conditions))) + (simulate [_ targets simulate-conditions] + (let [merged-conditions (merge conditions simulate-conditions)] + (gpm.proto/simulate gpm targets merged-conditions))) + gpm.proto/LogProb (logprob [_ targets logprob-conditions] (let [merged-conditions (merge conditions logprob-conditions)] (gpm.proto/logprob gpm targets merged-conditions))) - (simulate [_ targets simulate-conditions] - (let [merged-conditions (merge conditions simulate-conditions)] - (gpm.proto/simulate gpm targets merged-conditions))) - gpm.proto/Variables (variables [_] (gpm.proto/variables gpm)) diff --git a/src/inferenceql/inference/gpm/proto.cljc b/src/inferenceql/inference/gpm/proto.cljc index 8322bac..d19ea05 100644 --- a/src/inferenceql/inference/gpm/proto.cljc +++ b/src/inferenceql/inference/gpm/proto.cljc @@ -3,8 +3,8 @@ (defprotocol GPM "A simple protocol for defining a GPM." (logpdf [this targets constraints]) - (logprob [this targets constraints]) (simulate [this targets constraints]) + (logprob [this targets constraints]) (mutual-information [this target-a target-b constraints n-samples])) (defprotocol Incorporate From 53853a3aa2a68f880dbf77e464529d85aea0e6f5 Mon Sep 17 00:00:00 2001 From: joaoloula Date: Tue, 8 Nov 2022 12:47:35 -0500 Subject: [PATCH 03/13] reverted proto changes --- src/inferenceql/inference/gpm/proto.cljc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/inferenceql/inference/gpm/proto.cljc b/src/inferenceql/inference/gpm/proto.cljc index d19ea05..c98706f 100644 --- a/src/inferenceql/inference/gpm/proto.cljc +++ b/src/inferenceql/inference/gpm/proto.cljc @@ -4,7 +4,6 @@ "A simple protocol for defining a GPM." (logpdf [this targets constraints]) (simulate [this targets constraints]) - (logprob [this targets constraints]) (mutual-information [this target-a target-b constraints n-samples])) (defprotocol Incorporate From ded52ae0f6d7c0e58eeaf1a368827826935aa515 Mon Sep 17 00:00:00 2001 From: joaoloula Date: Tue, 8 Nov 2022 16:34:31 -0500 Subject: [PATCH 04/13] reducing conditions to event, no tests written --- src/inferenceql/inference/gpm/conditioned.cljc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/inferenceql/inference/gpm/conditioned.cljc b/src/inferenceql/inference/gpm/conditioned.cljc index 4914adc..8c7bd48 100644 --- a/src/inferenceql/inference/gpm/conditioned.cljc +++ b/src/inferenceql/inference/gpm/conditioned.cljc @@ -12,9 +12,12 @@ (gpm.proto/simulate gpm targets merged-conditions))) gpm.proto/LogProb - (logprob [_ targets logprob-conditions] - (let [merged-conditions (merge conditions logprob-conditions)] - (gpm.proto/logprob gpm targets merged-conditions))) + (logprob [_ event] + (def conditions_event `(~'and ~@(map (fn [[variable value]] + `(~'= ~variable ~value)) + conditions))) + (let [merged-event `(~'and ~conditions_event event)] + (gpm.proto/logprob gpm merged-event))) gpm.proto/Variables (variables [_] From 0839c67690cfe42b8b10a050e02b54be92e38e9d Mon Sep 17 00:00:00 2001 From: joaoloula Date: Tue, 8 Nov 2022 16:40:47 -0500 Subject: [PATCH 05/13] removed tentative logprob tests --- .../inference/gpm/conditioned_test.cljc | 65 ------------------- 1 file changed, 65 deletions(-) diff --git a/test/inferenceql/inference/gpm/conditioned_test.cljc b/test/inferenceql/inference/gpm/conditioned_test.cljc index 446bc0a..94ed879 100644 --- a/test/inferenceql/inference/gpm/conditioned_test.cljc +++ b/test/inferenceql/inference/gpm/conditioned_test.cljc @@ -39,23 +39,6 @@ [:x :y] {:y 1} [:x :y] {:x 0 :y 1})) -(deftest logprob-targets - (are [targets conditions] - (let [model (reify gpm.proto/LogProb - (logprob [_ actual _] - actual)) - conditioned-model (conditioned/condition model conditions)] - (= targets (gpm/logprob conditioned-model targets conditions))) - [] {} - [:x] {} - [] {:x 0} - [:x] {:x 0} - [:x :y] {} - [] {:x 0} - [:x :y] {:x 0} - [:x :y] {:y 1} - [:x :y] {:x 0 :y 1})) - (deftest logpdf-conditions (are [condition-conditions conditions expected] (let [model (reify gpm.proto/GPM @@ -72,22 +55,6 @@ {:x 0 :z 2} {:y 1} {:x 0 :y 1 :z 2} {:x 0} {:y 1 :z 2} {:x 0 :y 1 :z 2})) -(deftest logprob-conditions - (are [condition-conditions conditions expected] - (let [model (reify gpm.proto/LogProb - (logprob [_ _ actual] - actual)) - conditioned-model (conditioned/condition model condition-conditions)] - (= expected (gpm/logprob conditioned-model [:x] conditions))) - {} {} {} - {} {:x 0} {:x 0} - {:x 0} {} {:x 0} - {:x 0} {:x 1} {:x 1} - {:x 0} {:y 1} {:x 0 :y 1} - {:y 1} {:x 0} {:x 0 :y 1} - {:x 0 :z 2} {:y 1} {:x 0 :y 1 :z 2} - {:x 0} {:y 1 :z 2} {:x 0 :y 1 :z 2})) - (deftest simulate-conditions (are [c1 c2 expected] (let [model (reify gpm.proto/GPM @@ -134,36 +101,4 @@ {} {} {:x 0} {:x 0} {:x 0} {:x 1} {} {:x 1} {:x 0} {} {:x 1} {:x 1} - {} {:x 0} {:x 1} {:x 1})) - -(deftest logprob-condition - (are [c1 c2 expected] - (let [model (-> (reify gpm.proto/LogProb - (simulate [_ _ actual] - actual)) - (conditioned/condition c1))] - (= expected (gpm/simulate model [:x] c2))) - {} {} {} - {} {:x 0} {:x 0} - {:x 0} {} {:x 0} - {:x 0} {:x 1} {:x 1} - {:x 0} {:y 1} {:x 0 :y 1} - {:y 1} {:x 0} {:x 0 :y 1} - {:x 0 :z 2} {:y 1} {:x 0 :y 1 :z 2} - {:x 0} {:y 1 :z 2} {:x 0 :y 1 :z 2})) - -(deftest logprob-condition-twice - (are [c1 c2 c3 expected] - (let [model (-> (reify gpm.proto/LogProb - (simulate [_ _ actual] - actual)) - (conditioned/condition c1) - (conditioned/condition c2))] - (= expected (gpm/simulate model [:x] c3))) - {} {} {} {} - {:x 0} {} {} {:x 0} - {} {:x 0} {} {:x 0} - {} {} {:x 0} {:x 0} - {:x 0} {:x 1} {} {:x 1} - {:x 0} {} {:x 1} {:x 1} {} {:x 0} {:x 1} {:x 1})) \ No newline at end of file From c0cc98277f01abe5c40d72187443399f4cc4784d Mon Sep 17 00:00:00 2001 From: joaoloula Date: Wed, 9 Nov 2022 14:58:55 -0500 Subject: [PATCH 06/13] added a logprob-conditions test, passing --- src/inferenceql/inference/gpm/conditioned.cljc | 14 +++++++++----- .../inference/gpm/conditioned_test.cljc | 12 ++++++++++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/inferenceql/inference/gpm/conditioned.cljc b/src/inferenceql/inference/gpm/conditioned.cljc index 8c7bd48..d9d40fe 100644 --- a/src/inferenceql/inference/gpm/conditioned.cljc +++ b/src/inferenceql/inference/gpm/conditioned.cljc @@ -13,11 +13,15 @@ gpm.proto/LogProb (logprob [_ event] - (def conditions_event `(~'and ~@(map (fn [[variable value]] - `(~'= ~variable ~value)) - conditions))) - (let [merged-event `(~'and ~conditions_event event)] - (gpm.proto/logprob gpm merged-event))) + (let [ + expression_list (map (fn [[variable value]] `(~'= ~variable ~value)) conditions) + conditions_event + (if (< 1 (count expression_list)) + `(~'and ~@expression_list) + (first expression_list)) + merged-event `(~'and ~conditions_event ~event) + ] + (gpm.proto/logprob gpm merged-event))) gpm.proto/Variables (variables [_] diff --git a/test/inferenceql/inference/gpm/conditioned_test.cljc b/test/inferenceql/inference/gpm/conditioned_test.cljc index 94ed879..9243635 100644 --- a/test/inferenceql/inference/gpm/conditioned_test.cljc +++ b/test/inferenceql/inference/gpm/conditioned_test.cljc @@ -55,6 +55,18 @@ {:x 0 :z 2} {:y 1} {:x 0 :y 1 :z 2} {:x 0} {:y 1 :z 2} {:x 0 :y 1 :z 2})) +(deftest logprob-conditions + (are [condition-conditions event expected] + (let [model (reify gpm.proto/LogProb + (logprob [_ actual] + actual)) + conditioned-model (conditioned/condition model condition-conditions)] + (= expected (gpm/logprob conditioned-model event))) + + {:x 0} '(= :y 0) '(and (= :x 0) (= :y 0)) + {:x 0 :y 0} '(= :z 1) '(and (and (= :x 0) (= :y 0)) (= :z 1)) + )) + (deftest simulate-conditions (are [c1 c2 expected] (let [model (reify gpm.proto/GPM From c7b5b5c22bdd17d1ca52be4eb50c618fcad0bd63 Mon Sep 17 00:00:00 2001 From: Joao Loula Date: Mon, 14 Nov 2022 21:04:50 -0500 Subject: [PATCH 07/13] Update test/inferenceql/inference/gpm/conditioned_test.cljc Co-authored-by: Zane Shelby --- test/inferenceql/inference/gpm/conditioned_test.cljc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/inferenceql/inference/gpm/conditioned_test.cljc b/test/inferenceql/inference/gpm/conditioned_test.cljc index 9243635..5f0287b 100644 --- a/test/inferenceql/inference/gpm/conditioned_test.cljc +++ b/test/inferenceql/inference/gpm/conditioned_test.cljc @@ -64,8 +64,7 @@ (= expected (gpm/logprob conditioned-model event))) {:x 0} '(= :y 0) '(and (= :x 0) (= :y 0)) - {:x 0 :y 0} '(= :z 1) '(and (and (= :x 0) (= :y 0)) (= :z 1)) - )) + {:x 0 :y 0} '(= :z 1) '(and (and (= :x 0) (= :y 0)) (= :z 1)))) (deftest simulate-conditions (are [c1 c2 expected] From 9decae2d54c8ff37920a2515a9a964398662cdfc Mon Sep 17 00:00:00 2001 From: Leif Andersen Date: Tue, 19 Aug 2025 10:38:18 -0400 Subject: [PATCH 08/13] Address bug where key is not found in categorical --- src/gensql/inference/gpm/primitive_gpms/categorical.cljc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gensql/inference/gpm/primitive_gpms/categorical.cljc b/src/gensql/inference/gpm/primitive_gpms/categorical.cljc index c635808..5a69ae7 100644 --- a/src/gensql/inference/gpm/primitive_gpms/categorical.cljc +++ b/src/gensql/inference/gpm/primitive_gpms/categorical.cljc @@ -16,7 +16,7 @@ constrained? (if (= x x') 0 ##-Inf) :else (let [counts (:counts suff-stats) alpha (:alpha hyperparameters) - numer (math/log (+ alpha (get counts x))) + numer (math/log (+ alpha (get counts x 0))) denom (math/log (+ (* alpha (count counts)) (reduce + (vals counts))))] (- numer denom))))) From 7e1c0ded8a1cb9c49187fdcfdf99800c84a2778c Mon Sep 17 00:00:00 2001 From: Leif Andersen Date: Tue, 21 Oct 2025 14:08:08 -0400 Subject: [PATCH 09/13] VScode didn't save --- test/gensql/inference/gpm/conditioned_test.cljc | 6 ------ 1 file changed, 6 deletions(-) diff --git a/test/gensql/inference/gpm/conditioned_test.cljc b/test/gensql/inference/gpm/conditioned_test.cljc index cfc1bb8..748e587 100644 --- a/test/gensql/inference/gpm/conditioned_test.cljc +++ b/test/gensql/inference/gpm/conditioned_test.cljc @@ -112,7 +112,6 @@ {} {} {:x 0} {:x 0} {:x 0} {:x 1} {} {:x 1} {:x 0} {} {:x 1} {:x 1} -<<<<<<< HEAD:test/gensql/inference/gpm/conditioned_test.cljc {} {:x 0} {:x 1} {:x 1})) (deftest merged-conditions @@ -128,8 +127,3 @@ {:y 1} {:x 0} {:x 0 :y 1} {:x 0 :z 2} {:y 1} {:x 0 :y 1 :z 2} {:x 0} {:y 1 :z 2} {:x 0 :y 1 :z 2})) -||||||| f8b864b:test/inferenceql/inference/gpm/conditioned_test.cljc - {} {:x 0} {:x 1} {:x 1})) -======= - {} {:x 0} {:x 1} {:x 1})) ->>>>>>> joao/gpm_logprob:test/inferenceql/inference/gpm/conditioned_test.cljc From dae9c9cfa90a4459f57a5bfff74664257854b815 Mon Sep 17 00:00:00 2001 From: Leif Andersen Date: Tue, 21 Oct 2025 14:08:31 -0400 Subject: [PATCH 10/13] Add lsp to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 4ceb2bb..65210fe 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ pom.xml.asc /out/ /.clj-kondo/.cache/ /cljs-test-runner-out/ +.lsp From 1e08295f763b4d5d596db3b04a4880c6cb2a3fdc Mon Sep 17 00:00:00 2001 From: Leif Andersen Date: Tue, 21 Oct 2025 14:22:43 -0400 Subject: [PATCH 11/13] Add logprob to ensemble. (Note that this does NOT add it to XCat.) --- src/gensql/inference/gpm/ensemble.cljc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/gensql/inference/gpm/ensemble.cljc b/src/gensql/inference/gpm/ensemble.cljc index b45c20d..05ba026 100644 --- a/src/gensql/inference/gpm/ensemble.cljc +++ b/src/gensql/inference/gpm/ensemble.cljc @@ -21,22 +21,27 @@ (.sample ed))) (defrecord Ensemble [gpms] + gpm.proto/LogProb + (logprob [_ event] + (let [logprobs (map #(gpm.proto/logprob % event) gpms)] + (utils/logmeanexp logprobs))) + gpm.proto/GPM (simulate [_ targets constraints] (let [gpm (if-not (seq constraints) (rand-nth gpms) (weighted-sample - (zipmap gpms - (map #(gpm.proto/logpdf % constraints {}) - gpms))))] + (zipmap gpms + (map #(gpm.proto/logpdf % constraints {}) + gpms))))] (gpm.proto/simulate gpm targets constraints))) (logpdf [_ targets constraints] (let [logpdfs (map #(gpm.proto/logpdf % targets constraints) gpms)] (if (seq constraints) (utils/logmeanexp-weighted (map #(gpm.proto/logpdf % constraints {}) gpms) - logpdfs) - (utils/logmeanexp logpdfs)))) + logpdfs) + (utils/logmeanexp logpdfs)))) gpm.proto/Variables (variables [_] From b30bca3be904d01f618a9aeb3cb3974d74118788 Mon Sep 17 00:00:00 2001 From: Leif Andersen Date: Tue, 21 Oct 2025 16:09:36 -0400 Subject: [PATCH 12/13] The probability density of X | X should be infinit at X, not 1. --- src/gensql/inference/gpm/crosscat.cljc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gensql/inference/gpm/crosscat.cljc b/src/gensql/inference/gpm/crosscat.cljc index a6e5dd3..7b31024 100644 --- a/src/gensql/inference/gpm/crosscat.cljc +++ b/src/gensql/inference/gpm/crosscat.cljc @@ -81,7 +81,7 @@ ;; If targets are the same as constraints, the logpdf is 0. (cond (= targets constraints) - 0.0 + 99999 ;; Should be ##Inf ;; If the targets and constraints are not equal but the overlapping parts are, ;; just remove the overlapping keys and recur the scores. (every? (fn [shared-key] @@ -94,7 +94,7 @@ (apply dissoc targets intersection) constraints)] (+ logp view-logp))) - 0.0 + 99999 ;; Should be ##Inf views) ;; If the intersection keys map to different values, the score is -Inf. :else ##-Inf))) @@ -102,11 +102,11 @@ ;; Catch overlap of targets and constraints and assure constraint is sampled. (let [intersection (set/intersection (set targets) (set (keys constraints))) unconstrained-targets (vec (remove intersection (set targets)))] - (->> views - (map (fn [[_ view]] - (gpm.proto/simulate view unconstrained-targets constraints))) - (filter not-empty) - (apply merge (select-keys constraints intersection))))) + (->> views + (map (fn [[_ view]] + (gpm.proto/simulate view unconstrained-targets constraints))) + (filter not-empty) + (apply merge (select-keys constraints intersection))))) gpm.proto/Incorporate (incorporate [this x] (let [row-id (gensym)] From 7e0b52442a2d8455eb17918a57b74de67ee4ccc7 Mon Sep 17 00:00:00 2001 From: Leif Andersen Date: Tue, 21 Oct 2025 16:59:35 -0400 Subject: [PATCH 13/13] Revert previous change for now. The _descrete_ probability density makes sense to be 1, but not the continuous probability density. --- src/gensql/inference/gpm/crosscat.cljc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gensql/inference/gpm/crosscat.cljc b/src/gensql/inference/gpm/crosscat.cljc index 7b31024..e184fba 100644 --- a/src/gensql/inference/gpm/crosscat.cljc +++ b/src/gensql/inference/gpm/crosscat.cljc @@ -81,7 +81,7 @@ ;; If targets are the same as constraints, the logpdf is 0. (cond (= targets constraints) - 99999 ;; Should be ##Inf + 0.0 ;; Should be ##Inf for continuous functions ;; If the targets and constraints are not equal but the overlapping parts are, ;; just remove the overlapping keys and recur the scores. (every? (fn [shared-key] @@ -94,7 +94,7 @@ (apply dissoc targets intersection) constraints)] (+ logp view-logp))) - 99999 ;; Should be ##Inf + 0.0 views) ;; If the intersection keys map to different values, the score is -Inf. :else ##-Inf)))