Permalink
Browse files

Clean up simplicity calculation.

  • Loading branch information...
1 parent c4f1716 commit 9e1da7e68bb396bde50eeb3230f6d2ecd569ca71 @lynaghk lynaghk committed Mar 23, 2012
Showing with 6 additions and 5 deletions.
  1. +6 −5 src/clj/c2/ticks.clj
View
@@ -15,19 +15,20 @@
(first (for [[idx y] (map-indexed vector coll)
:when (= y x)] idx)))
+(defn label-range-contains-zero? [l-min l-max l-step]
+ (and (> l-max 0) (< l-min 0) (zero? (mod l-min l-step))))
(defn simplicity
"Objective function modeling niceness of step sizes and whether a range includes zero."
- [q Q j l-min l-max l-step]
- (let [v ;;Does the range contain zero?
- (and (> l-max 0)
- (< l-min 0)
- (zero? (mod l-min l-step)))]
+ [q Q j label-range-contains-zero]
+ (let [v (if label-range-contains-zero 1 0)]
(if (<= (count Q) 1)
(+ (- 1 j) v)
(+ (- 1 (/ (index-of q Q) (dec (count Q))) j)
v))))
+(defn max-simplicity [q Q j] (simplicity q Q j true))
+
(defn coverage
"Objective function based on distances between extreme data and extreme labels"
[d-min d-max l-min l-max]

0 comments on commit 9e1da7e

Please sign in to comment.