1.2.3-SNAPSHOT Arrow_down_16x16

tanimoto-coefficient

incanter.stats

  • (tanimoto-coefficient a b)


http://en.wikipedia.org/wiki/Jaccard_index

The cosine similarity metric may be extended such that it yields the Jaccard coefficient in the case of binary attributes. This is the Tanimoto coefficient.

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source incanter/stats.clj:3018 top

(defn tanimoto-coefficient
"

http://en.wikipedia.org/wiki/Jaccard_index

The cosine similarity metric may be extended such that it yields the Jaccard coefficient in the case of binary attributes. This is the Tanimoto coefficient. "
[a b]
(let [counts
(apply merge-with +
(map 
 (fn [[x y]]
   {:dot (* x y)
    :a (pow x 2)
    :b (pow y 2)})
 (map vector a b)))]
(/ (:dot counts)
   (- 
    (+ (:a counts)
       (:a counts))
    (:dot counts)))))
Vars in incanter.stats/tanimoto-coefficient: + - / defn let
Used in 0 other vars

Comments top

No comments for tanimoto-coefficient. Log in to add a comment.