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

add segment to table comparison endpoint

parent 2b13e580
Branches
Tags
No related merge requests found
......@@ -149,4 +149,15 @@
{:max-cost (max-cost max_query_cost max_computation_cost)})
fingerprinters/prettify))
(api/defendpoint GET "/compare/segment/:sid/table/:tid"
"Compare `Segment` with `Table`."
[sid tid max_query_cost max_computation_cost]
{max_query_cost MaxQueryCost
max_computation_cost MaxComputationCost}
(fingerprinters/prettify
(fingerprinting/compare-fingerprints
{:max-cost (max-cost max_query_cost max_computation_cost)}
(api/read-check Segment sid)
(api/read-check Table tid))))
(api/define-routes)
......@@ -124,7 +124,6 @@
(defn compare-fingerprints
"Compare fingerprints of two models."
[opts a b]
(assert (= (keys a) (keys b)))
(let [[a b] (map (partial fingerprint opts) [a b])]
{:constituents [a b]
:comparison (into {}
......
......@@ -131,6 +131,7 @@
:has-nils? (pos? nil-count)
:0<=x<=1? (<= 0 min max 1)
:-1<=x<=1? (<= -1 min max 1)
:cv (safe-divide mean sd)
:span-vs-sd (safe-divide span sd)
:mean-median-spread (safe-divide span (- mean median))
:min-vs-max (safe-divide min max)
......
......@@ -21,7 +21,7 @@
(def ^{:arglists '([^Histogram histogram])} categorical?
"Returns true if given histogram holds categorical values."
(comp some? impl/target-type))
(comp (complement #{:none}) impl/target-type))
(defn pdf
"Probability density function of given histogram.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment