Skip to content
Snippets Groups Projects
Commit 02f7a31e authored by Simon Belak's avatar Simon Belak
Browse files

defmulti doc workaround

parent 34d7734e
No related branches found
No related tags found
No related merge requests found
......@@ -27,10 +27,11 @@
(- 1 (/ product magnitude-a magnitude-b))))
(map vector a b)))
(defmulti difference
"Difference between two features.
Confined to [0, 1] with 0 being same, and 1 orthogonal."
#(mapv type %&))
(defmulti
^{:doc "Difference between two features.
Confined to [0, 1] with 0 being same, and 1 orthogonal."
:arglists '([a v])}
difference #(mapv type %&))
(defmethod difference [Number Number]
[a b]
......
......@@ -33,18 +33,19 @@
cols))
rows))
(defmulti fingerprint
"Given a model, fetch corresponding dataset and compute its fingerprint.
(defmulti
^{:doc "Given a model, fetch corresponding dataset and compute its fingerprint.
Takes a map of options as first argument. Recognized options:
* `:max-cost` a map with keys `:computation` and `:query` which
limits maximal resource expenditure when computing the
fingerprint. See `metabase.fingerprinting.costs` for
details.
Takes a map of options as first argument. Recognized options:
* `:max-cost` a map with keys `:computation` and `:query` which
limits maximal resource expenditure when computing
the fingerprint.
See `metabase.fingerprinting.costs` for details.
* `:scale` controls pre-aggregation by time. Can be one of `:day`,
`week`, `:month`, or `:raw`."
#(type %2))
* `:scale` controls pre-aggregation by time. Can be one of:
`:day`, `week`, `:month`, or `:raw`."
:arglists '([opts field])}
fingerprint #(type %2))
(def ^:private ^:const ^Long max-sample-size 10000)
......@@ -99,15 +100,15 @@
[{:keys [scale] :as opts} a b]
(merge (extract-query-opts opts)
(cond
(and (isa? (f/field-type a) f/DateTime)
(and (isa? (#'f/field-type a) #'f/DateTime)
(not= scale :raw)
(instance? (type Metric) b))
(merge (:definition b)
{:breakout [[:datetime-field [:field-id (:id a)] scale]]})
(and (isa? (f/field-type a) f/DateTime)
(and (isa? (#'f/field-type a) #'f/DateTime)
(not= scale :raw)
(isa? (f/field-type b) f/Num))
(isa? (#'f/field-type b) #'f/Num))
{:source-table (:table_id a)
:breakout [[:datetime-field [:field-id (:id a)] scale]]
:aggregation [:sum [:field-id (:id b)]]}
......
......@@ -69,6 +69,7 @@
:histogram-quarter {:label "Distribution of quarters"}})
(def ^{:arglists '([fingerprint])} add-descriptions
"Add descriptions of features to naked values where applicable."
(partial m/map-kv (fn [k v]
(if-let [description (descriptions k)]
[k (assoc description :value v)]
......
......@@ -61,11 +61,11 @@
(.offer acc x)
acc))
(def Num [:type/Number :type/*])
(def DateTime [:type/DateTime :type/*])
(def Category [:type/* :type/Category])
(def Any [:type/* :type/*])
(def Text [:type/Text :type/*])
(def ^:private Num [:type/Number :type/*])
(def ^:private DateTime [:type/DateTime :type/*])
(def ^:private Category [:type/* :type/Category])
(def ^:private Any [:type/* :type/*])
(def ^:private Text [:type/Text :type/*])
;;;;;;;;;;;;;;;;;; temporary cp until we merge the binning branch ;;;;;;;;;;
......@@ -90,6 +90,7 @@
;;;;;;;; cast to long
(defn order-of-magnitude
"Return oder of magnitude."
[x]
(if (zero? x)
0
......@@ -175,32 +176,35 @@
:description "Share of corresponding bin in the overall population."
:base_type :type/Float}]}))
(defn field-type
(defn- field-type
[field]
(if (sequential? field)
(mapv field-type field)
[(:base_type field) (or (:special_type field) :type/*)]))
(defmulti fingerprinter
"Transducer that summarizes (_fingerprints_) given coll. What features are
extracted depends on the type of corresponding `Field`(s), amount of data
points available (some algorithms have a minimum data points requirement)
and `max-cost.computation` setting.
Note we are heavily using data sketches so some summary values may be
approximate."
#(field-type %2))
(defmulti x-ray
"Make fingerprint human readable."
:type)
(defmulti
^{:doc "Transducer that summarizes (_fingerprints_) given coll. What features
are extracted depends on the type of corresponding `Field`(s), amount
of data points available (some algorithms have a minimum data points
requirement) and `max-cost.computation` setting.
Note we are heavily using data sketches so some summary values may be
approximate."
:arglists '([opts field])}
fingerprinter #(field-type %2))
(defmulti
^{:doc "Make fingerprint human readable."
:arglists '([fingerprint])}
x-ray :type)
(defmethod x-ray :default
[fingerprint]
fingerprint)
(defmulti comparison-vector
"Fingerprint feature vector for comparison/difference purposes."
:type)
(defmulti
^{:doc "Fingerprint feature vector for comparison/difference purposes."
:arglists '([fingerprint])}
comparison-vector :type)
(defmethod comparison-vector :default
[fingerprint]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment