diff --git a/README.md b/README.md index 96fb907..43fb700 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# inferenceql.inference +# GenSQL.inference -![tests](https://github.com/probcomp/inferenceql.inference/workflows/tests/badge.svg) -![linter](https://github.com/probcomp/inferenceql.inference/workflows/lint/badge.svg) +![tests](https://github.com/OpenGen/GenSQL.inference/workflows/tests/badge.svg) +![linter](https://github.com/OpenGen/GenSQL.inference/workflows/lint/badge.svg) diff --git a/src/inferenceql/inference/approximate.cljc b/src/gensql/inference/approximate.cljc similarity index 90% rename from src/inferenceql/inference/approximate.cljc rename to src/gensql/inference/approximate.cljc index 0c208c4..0aad2c7 100644 --- a/src/inferenceql/inference/approximate.cljc +++ b/src/gensql/inference/approximate.cljc @@ -1,6 +1,6 @@ -(ns inferenceql.inference.approximate - (:require [inferenceql.inference.gpm.proto :as gpm.proto] - [inferenceql.inference.utils :as utils])) +(ns gensql.inference.approximate + (:require [gensql.inference.gpm.proto :as gpm.proto] + [gensql.inference.utils :as utils])) (defn mutual-info "Given a GPM, estimates the mutual-information of `target-a` and `target-b` diff --git a/src/inferenceql/inference/distributions.cljc b/src/gensql/inference/distributions.cljc similarity index 96% rename from src/inferenceql/inference/distributions.cljc rename to src/gensql/inference/distributions.cljc index 789a85e..51f0b23 100644 --- a/src/inferenceql/inference/distributions.cljc +++ b/src/gensql/inference/distributions.cljc @@ -1,7 +1,7 @@ -(ns inferenceql.inference.distributions +(ns gensql.inference.distributions (:require [clojure.math :as math] [clojure.spec.alpha :as s] - [inferenceql.inference.gpm.multimixture.specification :as spec] + [gensql.inference.gpm.multimixture.specification :as spec] [metaprob.distributions] [metaprob.prelude :as mp])) diff --git a/src/inferenceql/inference/dpm.cljc b/src/gensql/inference/dpm.cljc similarity index 92% rename from src/inferenceql/inference/dpm.cljc rename to src/gensql/inference/dpm.cljc index c5cbde6..e5c74c2 100644 --- a/src/inferenceql/inference/dpm.cljc +++ b/src/gensql/inference/dpm.cljc @@ -1,4 +1,4 @@ -(ns inferenceql.inference.dpm +(ns gensql.inference.dpm "Functions operating on discriminative population models. All probabilistic models for which you can simulate and compute the log-PDF only for a set of dependent variables (most typically 1 column variable), and for which @@ -40,8 +40,8 @@ :dpm dpm})))) (defn assert-args-valid - "Asserts that `inferenceql.inference.gpm/logpdf` and - `inferenceql.inference.gpm/constraints` can be called with the provided + "Asserts that `gensql.inference.gpm/logpdf` and + `gensql.inference.gpm/constraints` can be called with the provided targeted and constrained variables." [dpm target-variables constrained-variables] (assert-targets-dependent dpm target-variables) diff --git a/src/inferenceql/inference/event.cljc b/src/gensql/inference/event.cljc similarity index 96% rename from src/inferenceql/inference/event.cljc rename to src/gensql/inference/event.cljc index 13ca26d..0e6f3b8 100644 --- a/src/inferenceql/inference/event.cljc +++ b/src/gensql/inference/event.cljc @@ -1,4 +1,4 @@ -(ns inferenceql.inference.event +(ns gensql.inference.event "Functions to process SPPL-style events.") (defn operator diff --git a/src/inferenceql/inference/gpm.cljc b/src/gensql/inference/gpm.cljc similarity index 82% rename from src/inferenceql/inference/gpm.cljc rename to src/gensql/inference/gpm.cljc index f61ca4c..c5c5557 100644 --- a/src/inferenceql/inference/gpm.cljc +++ b/src/gensql/inference/gpm.cljc @@ -1,19 +1,19 @@ -(ns inferenceql.inference.gpm +(ns gensql.inference.gpm (:refer-clojure :exclude [merge read read-string]) (:require [clojure.core :as clojure] [clojure.edn :as edn] - [inferenceql.inference.gpm.column :as column] - [inferenceql.inference.gpm.compositional :as compositional] - [inferenceql.inference.gpm.crosscat :as xcat] - #?(:clj [inferenceql.inference.gpm.ensemble :as ensemble]) - #?(:clj [inferenceql.inference.gpm.http :as http]) - [inferenceql.inference.gpm.multimixture :as mmix] - [inferenceql.inference.gpm.multimixture.specification :as mmix.spec] - [inferenceql.inference.gpm.primitive-gpms.bernoulli :as bernoulli] - [inferenceql.inference.gpm.primitive-gpms.categorical :as categorical] - [inferenceql.inference.gpm.primitive-gpms.gaussian :as gaussian] - [inferenceql.inference.gpm.proto :as gpm-proto] - [inferenceql.inference.gpm.view :as view])) + [gensql.inference.gpm.column :as column] + [gensql.inference.gpm.compositional :as compositional] + [gensql.inference.gpm.crosscat :as xcat] + #?(:clj [gensql.inference.gpm.ensemble :as ensemble]) + #?(:clj [gensql.inference.gpm.http :as http]) + [gensql.inference.gpm.multimixture :as mmix] + [gensql.inference.gpm.multimixture.specification :as mmix.spec] + [gensql.inference.gpm.primitive-gpms.bernoulli :as bernoulli] + [gensql.inference.gpm.primitive-gpms.categorical :as categorical] + [gensql.inference.gpm.primitive-gpms.gaussian :as gaussian] + [gensql.inference.gpm.proto :as gpm-proto] + [gensql.inference.gpm.view :as view])) #?(:clj (defn http @@ -144,7 +144,18 @@ (gpm-proto/constrain gpm event opts)) (def readers - {'inferenceql.inference.gpm.column.Column column/map->Column + {'gensql.inference.gpm.column.Column column/map->Column + 'gensql.inference.gpm.compositional.Compositional compositional/map->Compositional + 'gensql.inference.gpm.crosscat.XCat xcat/map->XCat + #?@(:clj ['gensql.inference.gpm.ensemble.Ensemble ensemble/map->Ensemble]) + 'gensql.inference.gpm.multimixture.Multimixture mmix/map->Multimixture + 'gensql.inference.gpm.primitive_gpms.bernoulli.Bernoulli bernoulli/map->Bernoulli + 'gensql.inference.gpm.primitive_gpms.categorical.Categorical categorical/map->Categorical + 'gensql.inference.gpm.primitive_gpms.gaussian.Gaussian gaussian/map->Gaussian + 'gensql.inference.gpm.view.View view/map->View + + ;; for backwards-compatibility with older models + 'inferenceql.inference.gpm.column.Column column/map->Column 'inferenceql.inference.gpm.compositional.Compositional compositional/map->Compositional 'inferenceql.inference.gpm.crosscat.XCat xcat/map->XCat #?@(:clj ['inferenceql.inference.gpm.ensemble.Ensemble ensemble/map->Ensemble]) @@ -166,7 +177,7 @@ (defn read "Like `clojure.edn/read` but includes readers for records in - `inferneceql.inference`." + `gensql.inference`." ([stream] (read {} stream)) ([opts stream] @@ -176,7 +187,7 @@ (defn ^:export read-string "Like `clojure.edn/read-string` but includes readers for records from - `inferenceql.inference`." + `gensql.inference`." ([s] (read-string {} s)) ([opts s] diff --git a/src/inferenceql/inference/gpm/column.cljc b/src/gensql/inference/gpm/column.cljc similarity index 97% rename from src/inferenceql/inference/gpm/column.cljc rename to src/gensql/inference/gpm/column.cljc index fd25ef4..5f45250 100644 --- a/src/inferenceql/inference/gpm/column.cljc +++ b/src/gensql/inference/gpm/column.cljc @@ -1,14 +1,14 @@ -(ns inferenceql.inference.gpm.column +(ns gensql.inference.gpm.column "Implementation of a GPM that represents a population of data of the same primitive type. For a tabular dataset, this GPM abstracts a Column - of that dataset. See `inferenceql.inference.gpm/column` for details." + of that dataset. See `gensql.inference.gpm/column` for details." (:require [clojure.math :as math] - [inferenceql.inference.gpm.conditioned :as conditioned] - [inferenceql.inference.gpm.constrained :as constrained] - [inferenceql.inference.gpm.primitive-gpms :as pgpms] - [inferenceql.inference.gpm.proto :as gpm.proto] - [inferenceql.inference.primitives :as primitives] - [inferenceql.inference.utils :as utils])) + [gensql.inference.gpm.conditioned :as conditioned] + [gensql.inference.gpm.constrained :as constrained] + [gensql.inference.gpm.primitive-gpms :as pgpms] + [gensql.inference.gpm.proto :as gpm.proto] + [gensql.inference.primitives :as primitives] + [gensql.inference.utils :as utils])) (defn crp-weights "Given a column and alpha, returns the CRP prior over categories." diff --git a/src/inferenceql/inference/gpm/compositional.cljc b/src/gensql/inference/gpm/compositional.cljc similarity index 86% rename from src/inferenceql/inference/gpm/compositional.cljc rename to src/gensql/inference/gpm/compositional.cljc index 13b39cd..a69ff7e 100644 --- a/src/inferenceql/inference/gpm/compositional.cljc +++ b/src/gensql/inference/gpm/compositional.cljc @@ -1,7 +1,7 @@ -(ns inferenceql.inference.gpm.compositional +(ns gensql.inference.gpm.compositional (:require [clojure.set :as set] - [inferenceql.inference.dpm :as dpm] - [inferenceql.inference.gpm.proto :as proto] + [gensql.inference.dpm :as dpm] + [gensql.inference.gpm.proto :as proto] [metaprob.distributions :as dist])) (defn ^:private monte-carlo-integration @@ -26,7 +26,7 @@ independent-targets (set/intersection target-variables independent-variables)] (cond (and (seq dependent-targets) (seq independent-targets)) - (throw (ex-info "`inferenceql.inference.gpm/logpdf` cannot be computed for a mixture of dependent and independent target variables." + (throw (ex-info "`gensql.inference.gpm/logpdf` cannot be computed for a mixture of dependent and independent target variables." {:dependent-targets dependent-targets :independent-targets independent-targets :dpm dpm})) diff --git a/src/inferenceql/inference/gpm/conditioned.cljc b/src/gensql/inference/gpm/conditioned.cljc similarity index 84% rename from src/inferenceql/inference/gpm/conditioned.cljc rename to src/gensql/inference/gpm/conditioned.cljc index 85dd507..e63d326 100644 --- a/src/inferenceql/inference/gpm/conditioned.cljc +++ b/src/gensql/inference/gpm/conditioned.cljc @@ -1,5 +1,5 @@ -(ns inferenceql.inference.gpm.conditioned - (:require [inferenceql.inference.gpm.proto :as gpm.proto])) +(ns gensql.inference.gpm.conditioned + (:require [gensql.inference.gpm.proto :as gpm.proto])) (defrecord ConditionedGPM [gpm conditions] gpm.proto/GPM @@ -23,7 +23,7 @@ (defn condition "Conditions gpm based on conditions via rejection sampling. Arguments are the - same as those for `inferenceql.inference.gom/condition`." + same as those for `gensql.inference.gom/condition`." [gpm conditions] (assert map? conditions) (->ConditionedGPM gpm conditions)) diff --git a/src/inferenceql/inference/gpm/constrained.cljc b/src/gensql/inference/gpm/constrained.cljc similarity index 94% rename from src/inferenceql/inference/gpm/constrained.cljc rename to src/gensql/inference/gpm/constrained.cljc index 5978fb5..8b6e510 100644 --- a/src/inferenceql/inference/gpm/constrained.cljc +++ b/src/gensql/inference/gpm/constrained.cljc @@ -1,7 +1,7 @@ -(ns inferenceql.inference.gpm.constrained +(ns gensql.inference.gpm.constrained (:refer-clojure :exclude [eval]) (:require [clojure.math :as math] - [inferenceql.inference.gpm.proto :as gpm.proto] + [gensql.inference.gpm.proto :as gpm.proto] [net.cgrand.xforms.rfs :as rfs])) (defn ^:private and-f @@ -78,7 +78,7 @@ (defn constrain "Constrains gpm based on event via rejection sampling. Arguments are the same - as those for `inferenceql.inference.gpm/constrain`." + as those for `gensql.inference.gpm/constrain`." [gpm event opts] (let [pred? (event->pred event opts) variables (event->variables event opts)] diff --git a/src/inferenceql/inference/gpm/crosscat.cljc b/src/gensql/inference/gpm/crosscat.cljc similarity index 97% rename from src/inferenceql/inference/gpm/crosscat.cljc rename to src/gensql/inference/gpm/crosscat.cljc index b898cdb..69dd426 100644 --- a/src/inferenceql/inference/gpm/crosscat.cljc +++ b/src/gensql/inference/gpm/crosscat.cljc @@ -1,13 +1,13 @@ -(ns inferenceql.inference.gpm.crosscat +(ns gensql.inference.gpm.crosscat (:require [clojure.set :as set] [clojure.edn :as edn] - [inferenceql.inference.gpm.conditioned :as conditioned] - [inferenceql.inference.gpm.constrained :as constrained] - [inferenceql.inference.gpm.view :as view] - [inferenceql.inference.gpm.column :as column] - [inferenceql.inference.gpm.primitive-gpms :as pgpms] - [inferenceql.inference.gpm.proto :as gpm.proto] - [inferenceql.inference.primitives :as primitives])) + [gensql.inference.gpm.conditioned :as conditioned] + [gensql.inference.gpm.constrained :as constrained] + [gensql.inference.gpm.view :as view] + [gensql.inference.gpm.column :as column] + [gensql.inference.gpm.primitive-gpms :as pgpms] + [gensql.inference.gpm.proto :as gpm.proto] + [gensql.inference.primitives :as primitives])) (defn update-hyper-grids "Given a collection of columns, updates the columns' respective hyper grids." diff --git a/src/inferenceql/inference/gpm/ensemble.cljc b/src/gensql/inference/gpm/ensemble.cljc similarity index 84% rename from src/inferenceql/inference/gpm/ensemble.cljc rename to src/gensql/inference/gpm/ensemble.cljc index 33400a9..b45c20d 100644 --- a/src/inferenceql/inference/gpm/ensemble.cljc +++ b/src/gensql/inference/gpm/ensemble.cljc @@ -1,9 +1,9 @@ -(ns inferenceql.inference.gpm.ensemble +(ns gensql.inference.gpm.ensemble (:require [clojure.math :as math] - [inferenceql.inference.gpm.conditioned :as conditioned] - [inferenceql.inference.gpm.constrained :as constrained] - [inferenceql.inference.gpm.proto :as gpm.proto] - [inferenceql.inference.utils :as utils]) + [gensql.inference.gpm.conditioned :as conditioned] + [gensql.inference.gpm.constrained :as constrained] + [gensql.inference.gpm.proto :as gpm.proto] + [gensql.inference.utils :as utils]) #?(:clj (:import [java.util ArrayList] [org.apache.commons.math3.distribution EnumeratedDistribution] [org.apache.commons.math3.util Pair]))) diff --git a/src/inferenceql/inference/gpm/http.clj b/src/gensql/inference/gpm/http.clj similarity index 86% rename from src/inferenceql/inference/gpm/http.clj rename to src/gensql/inference/gpm/http.clj index b4eddfe..9eefe46 100644 --- a/src/inferenceql/inference/gpm/http.clj +++ b/src/gensql/inference/gpm/http.clj @@ -1,10 +1,10 @@ -(ns inferenceql.inference.gpm.http +(ns gensql.inference.gpm.http "Implementation of a GPM that forwards requests over HTTP. See - `inferenceql.inference.gpm/http` for details." + `gensql.inference.gpm/http` for details." (:require [clj-http.client :as http] - [inferenceql.inference.gpm.conditioned :as conditioned] - [inferenceql.inference.gpm.constrained :as constrained] - [inferenceql.inference.gpm.proto :as proto] + [gensql.inference.gpm.conditioned :as conditioned] + [gensql.inference.gpm.constrained :as constrained] + [gensql.inference.gpm.proto :as proto] [jsonista.core :as json])) (defrecord HTTP [url] diff --git a/src/inferenceql/inference/gpm/multimixture.cljc b/src/gensql/inference/gpm/multimixture.cljc similarity index 86% rename from src/inferenceql/inference/gpm/multimixture.cljc rename to src/gensql/inference/gpm/multimixture.cljc index 42c8619..8179a36 100644 --- a/src/inferenceql/inference/gpm/multimixture.cljc +++ b/src/gensql/inference/gpm/multimixture.cljc @@ -1,9 +1,9 @@ -(ns inferenceql.inference.gpm.multimixture +(ns gensql.inference.gpm.multimixture (:require [metaprob.prelude :as mp] - [inferenceql.inference.gpm.conditioned :as conditioned] - [inferenceql.inference.gpm.constrained :as constrained] - [inferenceql.inference.gpm.multimixture.utils :as mmix.utils] - [inferenceql.inference.gpm.proto :as gpm-proto])) + [gensql.inference.gpm.conditioned :as conditioned] + [gensql.inference.gpm.constrained :as constrained] + [gensql.inference.gpm.multimixture.utils :as mmix.utils] + [gensql.inference.gpm.proto :as gpm-proto])) ;; XXX Currently, assumes that the row generator of the mmix map is passed in. (defrecord Multimixture [vars views] diff --git a/src/inferenceql/inference/gpm/multimixture/metrics.cljc b/src/gensql/inference/gpm/multimixture/metrics.cljc similarity index 94% rename from src/inferenceql/inference/gpm/multimixture/metrics.cljc rename to src/gensql/inference/gpm/multimixture/metrics.cljc index 191587c..c2c08ee 100644 --- a/src/inferenceql/inference/gpm/multimixture/metrics.cljc +++ b/src/gensql/inference/gpm/multimixture/metrics.cljc @@ -1,6 +1,6 @@ -(ns inferenceql.inference.gpm.multimixture.metrics +(ns gensql.inference.gpm.multimixture.metrics (:require [clojure.math :as math] - [inferenceql.inference.gpm.multimixture.utils :as utils])) + [gensql.inference.gpm.multimixture.utils :as utils])) (defn check-distribution-criteria "Checks basic assumptions about two distributions being compared. @@ -44,7 +44,7 @@ (defn jensen-shannon-divergence "Calculates the Jenson-Shannon divergence between two distributions. Since it depends on - `inferenceql.inference.multimixture.metrics/kl-divergence`, `p` must be zero + `gensql.inference.multimixture.metrics/kl-divergence`, `p` must be zero when `q` is zero. `p` and `q` must have the same alphabet size (i.e. length)." [p q] (check-distribution-criteria p q) diff --git a/src/inferenceql/inference/gpm/multimixture/metrics_viz.cljc b/src/gensql/inference/gpm/multimixture/metrics_viz.cljc similarity index 97% rename from src/inferenceql/inference/gpm/multimixture/metrics_viz.cljc rename to src/gensql/inference/gpm/multimixture/metrics_viz.cljc index 39efce9..15c6131 100644 --- a/src/inferenceql/inference/gpm/multimixture/metrics_viz.cljc +++ b/src/gensql/inference/gpm/multimixture/metrics_viz.cljc @@ -1,6 +1,6 @@ -(ns inferenceql.inference.gpm.multimixture.metrics-viz +(ns gensql.inference.gpm.multimixture.metrics-viz (:require [clojure.string :refer [split]] - [inferenceql.inference.gpm.multimixture.metrics :as metrics])) + [gensql.inference.gpm.multimixture.metrics :as metrics])) (defmacro with-out-str-data-time-map "Returns time and data of an expression of the form `(time expression)` diff --git a/src/inferenceql/inference/gpm/multimixture/search.cljc b/src/gensql/inference/gpm/multimixture/search.cljc similarity index 95% rename from src/inferenceql/inference/gpm/multimixture/search.cljc rename to src/gensql/inference/gpm/multimixture/search.cljc index e44e3fc..6e5c209 100644 --- a/src/inferenceql/inference/gpm/multimixture/search.cljc +++ b/src/gensql/inference/gpm/multimixture/search.cljc @@ -1,11 +1,11 @@ -(ns inferenceql.inference.gpm.multimixture.search +(ns gensql.inference.gpm.multimixture.search (:require [clojure.math :as math] [clojure.spec.alpha :as s] - [inferenceql.inference.distributions :as idbdist] - [inferenceql.inference.gpm :as gpm] - [inferenceql.inference.gpm.multimixture.specification :as spec] - [inferenceql.inference.gpm.multimixture.utils :as mmix.utils] - [inferenceql.inference.utils :as utils] + [gensql.inference.distributions :as idbdist] + [gensql.inference.gpm :as gpm] + [gensql.inference.gpm.multimixture.specification :as spec] + [gensql.inference.gpm.multimixture.utils :as mmix.utils] + [gensql.inference.utils :as utils] [metaprob.distributions :as dist] [metaprob.generative-functions :as g :refer [at gen]] [metaprob.prelude :as mp])) diff --git a/src/inferenceql/inference/gpm/multimixture/search/deterministic.cljc b/src/gensql/inference/gpm/multimixture/search/deterministic.cljc similarity index 93% rename from src/inferenceql/inference/gpm/multimixture/search/deterministic.cljc rename to src/gensql/inference/gpm/multimixture/search/deterministic.cljc index 56487db..964fa8c 100644 --- a/src/inferenceql/inference/gpm/multimixture/search/deterministic.cljc +++ b/src/gensql/inference/gpm/multimixture/search/deterministic.cljc @@ -1,6 +1,6 @@ -(ns inferenceql.inference.gpm.multimixture.search.deterministic - (:require [inferenceql.inference.utils :as utils] - [inferenceql.inference.gpm.multimixture.search.utils :as search.utils])) +(ns gensql.inference.gpm.multimixture.search.deterministic + (:require [gensql.inference.utils :as utils] + [gensql.inference.gpm.multimixture.search.utils :as search.utils])) #?(:cljs (enable-console-print!)) diff --git a/src/inferenceql/inference/gpm/multimixture/search/enumerative.cljc b/src/gensql/inference/gpm/multimixture/search/enumerative.cljc similarity index 94% rename from src/inferenceql/inference/gpm/multimixture/search/enumerative.cljc rename to src/gensql/inference/gpm/multimixture/search/enumerative.cljc index b83844d..ed4a65a 100644 --- a/src/inferenceql/inference/gpm/multimixture/search/enumerative.cljc +++ b/src/gensql/inference/gpm/multimixture/search/enumerative.cljc @@ -1,7 +1,7 @@ -(ns inferenceql.inference.gpm.multimixture.search.enumerative +(ns gensql.inference.gpm.multimixture.search.enumerative (:require [clojure.math.combinatorics :as combo] - [inferenceql.inference.utils :as utils] - [inferenceql.inference.gpm.multimixture.search.utils :as search.utils])) + [gensql.inference.utils :as utils] + [gensql.inference.gpm.multimixture.search.utils :as search.utils])) (defn rows->all-cluster-configurations "Returns a (lazy) sequence of all possible cluster configurations for rows." diff --git a/src/inferenceql/inference/gpm/multimixture/search/gibbs.cljc b/src/gensql/inference/gpm/multimixture/search/gibbs.cljc similarity index 96% rename from src/inferenceql/inference/gpm/multimixture/search/gibbs.cljc rename to src/gensql/inference/gpm/multimixture/search/gibbs.cljc index 8f2c203..2b63fec 100644 --- a/src/inferenceql/inference/gpm/multimixture/search/gibbs.cljc +++ b/src/gensql/inference/gpm/multimixture/search/gibbs.cljc @@ -1,6 +1,6 @@ -(ns inferenceql.inference.gpm.multimixture.search.gibbs +(ns gensql.inference.gpm.multimixture.search.gibbs (:require [metaprob.distributions :as dist] - [inferenceql.inference.gpm.multimixture.search.utils :as search.utils])) + [gensql.inference.gpm.multimixture.search.utils :as search.utils])) (defn sample-cluster-assignments "Given a probability table for rows, samples cluster assignments. A valid diff --git a/src/inferenceql/inference/gpm/multimixture/search/utils.cljc b/src/gensql/inference/gpm/multimixture/search/utils.cljc similarity index 91% rename from src/inferenceql/inference/gpm/multimixture/search/utils.cljc rename to src/gensql/inference/gpm/multimixture/search/utils.cljc index 613a177..5ce6b78 100644 --- a/src/inferenceql/inference/gpm/multimixture/search/utils.cljc +++ b/src/gensql/inference/gpm/multimixture/search/utils.cljc @@ -1,6 +1,6 @@ -(ns inferenceql.inference.gpm.multimixture.search.utils - (:require [inferenceql.inference.gpm.multimixture.utils :as mmix.utils] - [inferenceql.inference.utils :as utils] +(ns gensql.inference.gpm.multimixture.search.utils + (:require [gensql.inference.gpm.multimixture.utils :as mmix.utils] + [gensql.inference.utils :as utils] [metaprob.prelude :as mp])) (defn normalize-row-probability diff --git a/src/inferenceql/inference/gpm/multimixture/specification.cljc b/src/gensql/inference/gpm/multimixture/specification.cljc similarity index 99% rename from src/inferenceql/inference/gpm/multimixture/specification.cljc rename to src/gensql/inference/gpm/multimixture/specification.cljc index 15f9982..c45489b 100644 --- a/src/inferenceql/inference/gpm/multimixture/specification.cljc +++ b/src/gensql/inference/gpm/multimixture/specification.cljc @@ -1,4 +1,4 @@ -(ns inferenceql.inference.gpm.multimixture.specification +(ns gensql.inference.gpm.multimixture.specification (:require [clojure.spec.alpha :as s])) (s/def ::alpha pos?) diff --git a/src/inferenceql/inference/gpm/multimixture/utils.cljc b/src/gensql/inference/gpm/multimixture/utils.cljc similarity index 97% rename from src/inferenceql/inference/gpm/multimixture/utils.cljc rename to src/gensql/inference/gpm/multimixture/utils.cljc index 8b9eafb..636c7e5 100644 --- a/src/inferenceql/inference/gpm/multimixture/utils.cljc +++ b/src/gensql/inference/gpm/multimixture/utils.cljc @@ -1,4 +1,4 @@ -(ns inferenceql.inference.gpm.multimixture.utils +(ns gensql.inference.gpm.multimixture.utils #?(:cljs (:require-macros [metaprob.generative-functions :refer [gen]])) (:require [clojure.math.combinatorics :as combo] [clojure.spec.alpha :as s] @@ -6,7 +6,7 @@ :cljs [metaprob.generative-functions :as g :refer [apply-at at]]) [metaprob.distributions :as dist] [metaprob.prelude :as mp] - [inferenceql.inference.gpm.multimixture.specification :as spec])) + [gensql.inference.gpm.multimixture.specification :as spec])) (defn row-generator "Returns a generative function that samples a row from the provided view diff --git a/src/inferenceql/inference/gpm/primitive_gpms.cljc b/src/gensql/inference/gpm/primitive_gpms.cljc similarity index 85% rename from src/inferenceql/inference/gpm/primitive_gpms.cljc rename to src/gensql/inference/gpm/primitive_gpms.cljc index 1be5735..2e27d2c 100644 --- a/src/inferenceql/inference/gpm/primitive_gpms.cljc +++ b/src/gensql/inference/gpm/primitive_gpms.cljc @@ -1,7 +1,7 @@ -(ns inferenceql.inference.gpm.primitive-gpms - (:require [inferenceql.inference.gpm.primitive-gpms.bernoulli :as bernoulli] - [inferenceql.inference.gpm.primitive-gpms.categorical :as categorical] - [inferenceql.inference.gpm.primitive-gpms.gaussian :as gaussian])) +(ns gensql.inference.gpm.primitive-gpms + (:require [gensql.inference.gpm.primitive-gpms.bernoulli :as bernoulli] + [gensql.inference.gpm.primitive-gpms.categorical :as categorical] + [gensql.inference.gpm.primitive-gpms.gaussian :as gaussian])) (defn primitive? "Checks whether the given GPM is a primitive GPM." diff --git a/src/inferenceql/inference/gpm/primitive_gpms/bernoulli.cljc b/src/gensql/inference/gpm/primitive_gpms/bernoulli.cljc similarity index 92% rename from src/inferenceql/inference/gpm/primitive_gpms/bernoulli.cljc rename to src/gensql/inference/gpm/primitive_gpms/bernoulli.cljc index a9ec0d8..9716cfa 100644 --- a/src/inferenceql/inference/gpm/primitive_gpms/bernoulli.cljc +++ b/src/gensql/inference/gpm/primitive_gpms/bernoulli.cljc @@ -1,9 +1,9 @@ -(ns inferenceql.inference.gpm.primitive-gpms.bernoulli +(ns gensql.inference.gpm.primitive-gpms.bernoulli (:require [clojure.math :as math] - [inferenceql.inference.event :as event] - [inferenceql.inference.gpm.proto :as gpm.proto] - [inferenceql.inference.primitives :as primitives] - [inferenceql.inference.utils :as utils])) + [gensql.inference.event :as event] + [gensql.inference.gpm.proto :as gpm.proto] + [gensql.inference.primitives :as primitives] + [gensql.inference.utils :as utils])) (defrecord Bernoulli [var-name suff-stats hyperparameters] gpm.proto/GPM diff --git a/src/inferenceql/inference/gpm/primitive_gpms/categorical.cljc b/src/gensql/inference/gpm/primitive_gpms/categorical.cljc similarity index 93% rename from src/inferenceql/inference/gpm/primitive_gpms/categorical.cljc rename to src/gensql/inference/gpm/primitive_gpms/categorical.cljc index 65079db..c635808 100644 --- a/src/inferenceql/inference/gpm/primitive_gpms/categorical.cljc +++ b/src/gensql/inference/gpm/primitive_gpms/categorical.cljc @@ -1,9 +1,9 @@ -(ns inferenceql.inference.gpm.primitive-gpms.categorical +(ns gensql.inference.gpm.primitive-gpms.categorical (:require [clojure.math :as math] - [inferenceql.inference.event :as event] - [inferenceql.inference.gpm.proto :as gpm.proto] - [inferenceql.inference.primitives :as primitives] - [inferenceql.inference.utils :as utils])) + [gensql.inference.event :as event] + [gensql.inference.gpm.proto :as gpm.proto] + [gensql.inference.primitives :as primitives] + [gensql.inference.utils :as utils])) (defrecord Categorical [var-name suff-stats hyperparameters] gpm.proto/GPM diff --git a/src/inferenceql/inference/gpm/primitive_gpms/gaussian.cljc b/src/gensql/inference/gpm/primitive_gpms/gaussian.cljc similarity index 95% rename from src/inferenceql/inference/gpm/primitive_gpms/gaussian.cljc rename to src/gensql/inference/gpm/primitive_gpms/gaussian.cljc index c3348f2..78cb2a2 100644 --- a/src/inferenceql/inference/gpm/primitive_gpms/gaussian.cljc +++ b/src/gensql/inference/gpm/primitive_gpms/gaussian.cljc @@ -1,11 +1,11 @@ -(ns inferenceql.inference.gpm.primitive-gpms.gaussian +(ns gensql.inference.gpm.primitive-gpms.gaussian (:require [clojure.math :as math] - [inferenceql.inference.event :as event] - [inferenceql.inference.gpm.proto :as gpm.proto] - [inferenceql.inference.primitives :as primitives] - [inferenceql.inference.event :as event] - [inferenceql.inference.utils :as utils]) + [gensql.inference.event :as event] + [gensql.inference.gpm.proto :as gpm.proto] + [gensql.inference.primitives :as primitives] + [gensql.inference.event :as event] + [gensql.inference.utils :as utils]) #?(:clj (:import [org.apache.commons.math3.distribution TDistribution]))) (defn posterior-hypers diff --git a/src/inferenceql/inference/gpm/proto.cljc b/src/gensql/inference/gpm/proto.cljc similarity index 97% rename from src/inferenceql/inference/gpm/proto.cljc rename to src/gensql/inference/gpm/proto.cljc index c98706f..67ccd41 100644 --- a/src/inferenceql/inference/gpm/proto.cljc +++ b/src/gensql/inference/gpm/proto.cljc @@ -1,4 +1,4 @@ -(ns inferenceql.inference.gpm.proto) +(ns gensql.inference.gpm.proto) (defprotocol GPM "A simple protocol for defining a GPM." diff --git a/src/inferenceql/inference/gpm/utils.cljc b/src/gensql/inference/gpm/utils.cljc similarity index 92% rename from src/inferenceql/inference/gpm/utils.cljc rename to src/gensql/inference/gpm/utils.cljc index f605445..50d1de5 100644 --- a/src/inferenceql/inference/gpm/utils.cljc +++ b/src/gensql/inference/gpm/utils.cljc @@ -1,6 +1,6 @@ -(ns inferenceql.inference.gpm.utils +(ns gensql.inference.gpm.utils (:require [clojure.math :as math] - [inferenceql.inference.utils :as utils])) + [gensql.inference.utils :as utils])) (defn crp-weights "Given a GPM and the number of auxiliary sub-GPMs, calculates the associated CRP weights. diff --git a/src/inferenceql/inference/gpm/view.cljc b/src/gensql/inference/gpm/view.cljc similarity index 97% rename from src/inferenceql/inference/gpm/view.cljc rename to src/gensql/inference/gpm/view.cljc index 279a263..48f7bfb 100644 --- a/src/inferenceql/inference/gpm/view.cljc +++ b/src/gensql/inference/gpm/view.cljc @@ -1,18 +1,18 @@ -(ns inferenceql.inference.gpm.view +(ns gensql.inference.gpm.view "Implementation of a GPM that represents a population of data of potentially different primitive types, but the same row categorizations. For a tabular dataset, this GPM abstracts a subset of columns of that dataset, the rows of which are clustered together in categories. This can also be considered as Dirichlet Process Mixture Model (DPMM). - See `inferenceql.inference.gpm/view` for details." + See `gensql.inference.gpm/view` for details." (:require [clojure.math :as math] [clojure.set] - [inferenceql.inference.gpm.column :as column] - [inferenceql.inference.gpm.conditioned :as conditioned] - [inferenceql.inference.gpm.constrained :as constrained] - [inferenceql.inference.gpm.proto :as gpm.proto] - [inferenceql.inference.gpm.utils :as gpm.utils] - [inferenceql.inference.primitives :as primitives] - [inferenceql.inference.utils :as utils])) + [gensql.inference.gpm.column :as column] + [gensql.inference.gpm.conditioned :as conditioned] + [gensql.inference.gpm.constrained :as constrained] + [gensql.inference.gpm.proto :as gpm.proto] + [gensql.inference.gpm.utils :as gpm.utils] + [gensql.inference.primitives :as primitives] + [gensql.inference.utils :as utils])) (defn column-logpdfs "Given a map of columns, and targets, returns a map of category probabilities of the targets." diff --git a/src/inferenceql/inference/inference.cljc b/src/gensql/inference/inference.cljc similarity index 76% rename from src/inferenceql/inference/inference.cljc rename to src/gensql/inference/inference.cljc index 7893e08..0795b0f 100644 --- a/src/inferenceql/inference/inference.cljc +++ b/src/gensql/inference/inference.cljc @@ -1,11 +1,11 @@ -(ns inferenceql.inference.inference +(ns gensql.inference.inference (:require [progrock.core :as prog] - [inferenceql.inference.gpm.view :as view] - [inferenceql.inference.gpm.crosscat :as xcat] - [inferenceql.inference.kernels.category :as category] - [inferenceql.inference.kernels.hyperparameters :as col-hypers] - [inferenceql.inference.kernels.concentration-hypers :as conc-hypers] - [inferenceql.inference.kernels.view :as k.view])) + [gensql.inference.gpm.view :as view] + [gensql.inference.gpm.crosscat :as xcat] + [gensql.inference.kernels.category :as category] + [gensql.inference.kernels.hyperparameters :as col-hypers] + [gensql.inference.kernels.concentration-hypers :as conc-hypers] + [gensql.inference.kernels.view :as k.view])) (defn pr-status-bar [bar] diff --git a/src/inferenceql/inference/js.cljs b/src/gensql/inference/js.cljs similarity index 96% rename from src/inferenceql/inference/js.cljs rename to src/gensql/inference/js.cljs index eb8418a..2978a28 100644 --- a/src/inferenceql/inference/js.cljs +++ b/src/gensql/inference/js.cljs @@ -1,6 +1,6 @@ -(ns inferenceql.inference.js +(ns gensql.inference.js "Functions from the gpm namespace for use from Javascript." - (:require [inferenceql.inference.gpm :as gpm] + (:require [gensql.inference.gpm :as gpm] [cljs-bean.core :refer [->clj]])) (defn ^:export isGPM diff --git a/src/inferenceql/inference/kernels/category.cljc b/src/gensql/inference/kernels/category.cljc similarity index 89% rename from src/inferenceql/inference/kernels/category.cljc rename to src/gensql/inference/kernels/category.cljc index 9e299c7..265f204 100644 --- a/src/inferenceql/inference/kernels/category.cljc +++ b/src/gensql/inference/kernels/category.cljc @@ -1,6 +1,6 @@ -(ns inferenceql.inference.kernels.category - (:require [inferenceql.inference.gpm.view :as view] - [inferenceql.inference.gpm.crosscat :as xcat])) +(ns gensql.inference.kernels.category + (:require [gensql.inference.gpm.view :as view] + [gensql.inference.gpm.crosscat :as xcat])) #?(:clj (defn save-latents-raw diff --git a/src/inferenceql/inference/kernels/concentration_hypers.cljc b/src/gensql/inference/kernels/concentration_hypers.cljc similarity index 93% rename from src/inferenceql/inference/kernels/concentration_hypers.cljc rename to src/gensql/inference/kernels/concentration_hypers.cljc index 5647720..e360801 100644 --- a/src/inferenceql/inference/kernels/concentration_hypers.cljc +++ b/src/gensql/inference/kernels/concentration_hypers.cljc @@ -1,10 +1,10 @@ -(ns inferenceql.inference.kernels.concentration-hypers +(ns gensql.inference.kernels.concentration-hypers (:require #?(:clj [clojure.data.json :as json]) [clojure.math :as math] - [inferenceql.inference.gpm.crosscat :as xcat] - [inferenceql.inference.gpm.view :as view] - [inferenceql.inference.primitives :as primitives] - [inferenceql.inference.utils :as utils])) + [gensql.inference.gpm.crosscat :as xcat] + [gensql.inference.gpm.view :as view] + [gensql.inference.primitives :as primitives] + [gensql.inference.utils :as utils])) (defn score-alpha "Given sufficient statistics for a CRP, calculates the logpdf for a proposed alpha. diff --git a/src/inferenceql/inference/kernels/hyperparameters.cljc b/src/gensql/inference/kernels/hyperparameters.cljc similarity index 91% rename from src/inferenceql/inference/kernels/hyperparameters.cljc rename to src/gensql/inference/kernels/hyperparameters.cljc index 20ea00d..d777134 100644 --- a/src/inferenceql/inference/kernels/hyperparameters.cljc +++ b/src/gensql/inference/kernels/hyperparameters.cljc @@ -1,9 +1,9 @@ -(ns inferenceql.inference.kernels.hyperparameters - (:require [inferenceql.inference.gpm.column :as column] - [inferenceql.inference.gpm.view :as view] - [inferenceql.inference.gpm.crosscat :as xcat] - [inferenceql.inference.utils :as utils] - [inferenceql.inference.primitives :as primitives])) +(ns gensql.inference.kernels.hyperparameters + (:require [gensql.inference.gpm.column :as column] + [gensql.inference.gpm.view :as view] + [gensql.inference.gpm.crosscat :as xcat] + [gensql.inference.utils :as utils] + [gensql.inference.primitives :as primitives])) (defn sample-hyper-parameter "Given a Column GPM and a hyperparameter name, samples a new value of the diff --git a/src/inferenceql/inference/kernels/view.cljc b/src/gensql/inference/kernels/view.cljc similarity index 89% rename from src/inferenceql/inference/kernels/view.cljc rename to src/gensql/inference/kernels/view.cljc index 4312422..faf68ac 100644 --- a/src/inferenceql/inference/kernels/view.cljc +++ b/src/gensql/inference/kernels/view.cljc @@ -1,8 +1,8 @@ -(ns inferenceql.inference.kernels.view - (:require [inferenceql.inference.utils :as utils] - [inferenceql.inference.gpm.utils :as gpm.utils] - [inferenceql.inference.primitives :as primitives] - [inferenceql.inference.gpm.crosscat :as xcat])) +(ns gensql.inference.kernels.view + (:require [gensql.inference.utils :as utils] + [gensql.inference.gpm.utils :as gpm.utils] + [gensql.inference.primitives :as primitives] + [gensql.inference.gpm.crosscat :as xcat])) (defn infer-column-view-xcat "Given a XCat GPM, returns the GPM with updated latent column-view assignments." diff --git a/src/inferenceql/inference/metrics/benchmark.clj b/src/gensql/inference/metrics/benchmark.clj similarity index 98% rename from src/inferenceql/inference/metrics/benchmark.clj rename to src/gensql/inference/metrics/benchmark.clj index d37b26b..c3ffd83 100644 --- a/src/inferenceql/inference/metrics/benchmark.clj +++ b/src/gensql/inference/metrics/benchmark.clj @@ -1,13 +1,13 @@ -(ns inferenceql.inference.metrics.benchmark +(ns gensql.inference.metrics.benchmark (:require [clojure.data.json :as json] [clojure.java.io :as io] [clojure.math :as math] [clojure.set] [clojure.string :as string] - [inferenceql.inference.gpm :as gpm] - [inferenceql.inference.gpm.crosscat :as xcat] - [inferenceql.inference.gpm.view :as view] - [inferenceql.inference.utils :as utils])) + [gensql.inference.gpm :as gpm] + [gensql.inference.gpm.crosscat :as xcat] + [gensql.inference.gpm.view :as view] + [gensql.inference.utils :as utils])) (defn dpmm-gen-fn "Given types, options, and training data for a DPMM model, diff --git a/src/inferenceql/inference/models/data/satellites.csv b/src/gensql/inference/models/data/satellites.csv similarity index 100% rename from src/inferenceql/inference/models/data/satellites.csv rename to src/gensql/inference/models/data/satellites.csv diff --git a/src/inferenceql/inference/models/load.clj b/src/gensql/inference/models/load.clj similarity index 82% rename from src/inferenceql/inference/models/load.clj rename to src/gensql/inference/models/load.clj index 3412ef1..8554604 100644 --- a/src/inferenceql/inference/models/load.clj +++ b/src/gensql/inference/models/load.clj @@ -1,17 +1,17 @@ -(ns inferenceql.inference.models.load +(ns gensql.inference.models.load (:require [clojure.string :as string :refer [lower-case]] [clojure.data.csv :as csv] [clojure.java.io :as io] [clojure.walk :as walk] [clojure.edn :as edn] [medley.core :as medley] - [inferenceql.inference.gpm.view :as view] - [inferenceql.inference.gpm.crosscat :as xcat])) + [gensql.inference.gpm.view :as view] + [gensql.inference.gpm.crosscat :as xcat])) (defn value-coercer "Returns a function that will attempt to coerce a value to a data type compatible with the given statistical type. - This function was copied from iql.query. + This function was copied from gensql.query. It should be removed when it is available in a separate repo." [stattype] (let [coerce (case stattype @@ -25,7 +25,7 @@ (defn row-coercer "Returns a function that will attempt to coerce the values in a map to values that match on the statistical types provided. - This function was copied from iql.query. + This function was copied from gensql.query. It should be removed when it is available in a separate repo." [variable->stattype] (fn [row] @@ -85,24 +85,24 @@ :gaussian :categorical)))) -(defn iql-inference-type - "Given a `schema` from iql.auto-modeling, returns the iql.inference type for `variable`." +(defn gensql-inference-type + "Given a `schema` from gensql.structure-learning, returns the gensql.inference type for `variable`." [schema variable] - (let [iql-type (get schema variable) - ;; Maps from auto-modeling types to iql.inference types. + (let [gensql-type (get schema variable) + ;; Maps from structure-learning types to gensql.inference types. conversion {:numerical :gaussian :nominal :categorical}] - ;; NOTE: We should not see :ignored columns if iql.inferece is used via the - ;; iql.auto-modeling pipeline as it provides ignored.csv, which has ignored + ;; NOTE: We should not see :ignored columns if gensql.inferece is used via the + ;; gensql.structure-learning pipeline as it provides ignored.csv, which has ignored ;; columns removed. - (assert (not= :ignored iql-type)) - (conversion iql-type))) + (assert (not= :ignored gensql-type)) + (conversion gensql-type))) (defn options "Returns a collection of unique values taken on by `col` in `data`" [data col] - ;; We can assume the null character is "" because when iql.inference is used - ;; via iql.auto-modeling, data should have gone through a nullification stage. + ;; We can assume the null character is "" because when gensql.inference is used + ;; via gensql.structure-learning, data should have gone through a nullification stage. (->> data (map #(get % col)) (remove #(string/blank? (str %))) @@ -110,12 +110,12 @@ (defn types-and-options "Returns a map of with :types and :options. - :types - map of column name to iql.inference type. + :types - map of column name to gensql.inference type. :options - map of column name to unique category options, for categorical columns." [schema data] (let [col-names (keys (first data))] (reduce (fn [acc col] - (let [var-type (iql-inference-type schema col)] + (let [var-type (gensql-inference-type schema col)] (cond-> (assoc-in acc [:types col] var-type) ;; If the type is categorical, we must record all possible ;; values the col could assume. diff --git a/src/inferenceql/inference/primitives.cljc b/src/gensql/inference/primitives.cljc similarity index 98% rename from src/inferenceql/inference/primitives.cljc rename to src/gensql/inference/primitives.cljc index 0054383..50af70e 100644 --- a/src/inferenceql/inference/primitives.cljc +++ b/src/gensql/inference/primitives.cljc @@ -1,7 +1,7 @@ -(ns inferenceql.inference.primitives +(ns gensql.inference.primitives (:require [clojure.math :as math] - [inferenceql.inference.utils :as utils] - #?(:cljs [inferenceql.inference.distributions :as dist])) + [gensql.inference.utils :as utils] + #?(:cljs [gensql.inference.distributions :as dist])) #?(:clj (:import [org.apache.commons.math3.special Gamma] [org.apache.commons.math3.random RandomDataGenerator]))) diff --git a/src/inferenceql/inference/scripts/clojurecat.clj b/src/gensql/inference/scripts/clojurecat.clj similarity index 94% rename from src/inferenceql/inference/scripts/clojurecat.clj rename to src/gensql/inference/scripts/clojurecat.clj index 7c8f503..781b800 100644 --- a/src/inferenceql/inference/scripts/clojurecat.clj +++ b/src/gensql/inference/scripts/clojurecat.clj @@ -1,9 +1,9 @@ -(ns inferenceql.inference.scripts.clojurecat +(ns gensql.inference.scripts.clojurecat (:require [clojure.tools.cli :refer [parse-opts]] [clojure.java.io :as io] [clojure.edn :as edn] - [inferenceql.inference.models.load :as models.load] - [inferenceql.inference.inference :as infer]) + [gensql.inference.models.load :as models.load] + [gensql.inference.inference :as infer]) (:gen-class)) (def cli-options diff --git a/src/inferenceql/inference/scripts/simple-satellites-model.edn b/src/gensql/inference/scripts/simple-satellites-model.edn similarity index 100% rename from src/inferenceql/inference/scripts/simple-satellites-model.edn rename to src/gensql/inference/scripts/simple-satellites-model.edn diff --git a/src/inferenceql/inference/search/crosscat.cljc b/src/gensql/inference/search/crosscat.cljc similarity index 87% rename from src/inferenceql/inference/search/crosscat.cljc rename to src/gensql/inference/search/crosscat.cljc index f7bc2fb..83568a0 100644 --- a/src/inferenceql/inference/search/crosscat.cljc +++ b/src/gensql/inference/search/crosscat.cljc @@ -1,7 +1,7 @@ -(ns inferenceql.inference.search.crosscat - (:require [inferenceql.inference.kernels.hyperparameters :as col-hypers] - [inferenceql.inference.gpm.column :as column] - [inferenceql.inference.gpm.crosscat :as crosscat])) +(ns gensql.inference.search.crosscat + (:require [gensql.inference.kernels.hyperparameters :as col-hypers] + [gensql.inference.gpm.column :as column] + [gensql.inference.gpm.crosscat :as crosscat])) (defn get-largest-view "Given an `xcat` gpm, this returns the view-id and view with the largest number of columns. diff --git a/src/inferenceql/inference/search/view.cljc b/src/gensql/inference/search/view.cljc similarity index 86% rename from src/inferenceql/inference/search/view.cljc rename to src/gensql/inference/search/view.cljc index 9abd396..0211f29 100644 --- a/src/inferenceql/inference/search/view.cljc +++ b/src/gensql/inference/search/view.cljc @@ -1,7 +1,7 @@ -(ns inferenceql.inference.search.view - (:require [inferenceql.inference.kernels.hyperparameters :as col-hypers] - [inferenceql.inference.gpm.view :as view] - [inferenceql.inference.gpm.column :as column] [inferenceql.inference.gpm.proto :as gpm.proto])) +(ns gensql.inference.search.view + (:require [gensql.inference.kernels.hyperparameters :as col-hypers] + [gensql.inference.gpm.view :as view] + [gensql.inference.gpm.column :as column] [gensql.inference.gpm.proto :as gpm.proto])) (defn generate-logpdf "Given a view, variable name, and row-id, calculates the logpdf diff --git a/src/inferenceql/inference/utils.cljc b/src/gensql/inference/utils.cljc similarity index 95% rename from src/inferenceql/inference/utils.cljc rename to src/gensql/inference/utils.cljc index 956ddaf..4f9a1f7 100644 --- a/src/inferenceql/inference/utils.cljc +++ b/src/gensql/inference/utils.cljc @@ -1,4 +1,4 @@ -(ns inferenceql.inference.utils +(ns gensql.inference.utils #?(:clj (:require [clojure.java.io :as io])) (:require [clojure.math :as math])) @@ -49,14 +49,14 @@ (defn almost-equal? "Returns true if scalars `a` and `b` are approximately equal. Takes a distance - metric (presumably from `inferenceql.metrics`) as its second argument. An example + metric (presumably from `gensql.metrics`) as its second argument. An example for a distance metric is Euclidean distance." [a b difference-metric threshold] (< (difference-metric a b) threshold)) (defn almost-equal-vectors? "Returns true if vectors `a` and `b` are approximately equal. Takes a difference - metric (presumably from `inferenceql.metrics`) as its second argument." + metric (presumably from `gensql.metrics`) as its second argument." [a b difference-metric threshold] (assert (count a) (count b)) (let [call-almost-equal @@ -65,7 +65,7 @@ (defn almost-equal-maps? "Returns true if maps `a` and `b` are approximately equal. Takes a distance - metric (presumably from `inferenceql.metrics`) as its second argument." + metric (presumably from `gensql.metrics`) as its second argument." [a b distance-metric threshold] (let [ks (keys a)] (almost-equal-vectors? (map #(get a %) ks)