Skip to content

Commit

Permalink
Adapted tests for metric
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhanika committed Feb 4, 2025
1 parent e1eb31a commit 43896b7
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/test/clojure/conexp/fca/metrics_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
(is (== (set-based-minkowski-distance #{'a} #{}) 1))
(is (== (set-based-minkowski-distance #{} #{'a}) 1))
(is (>= (set-based-minkowski-distance #{'a 'b} #{'a 'c} 2) 0.58))
(is (>= (set-based-minkowski-distance #{'a 'b} #{'a 'c} 2) 0.59))))
(is (<= (set-based-minkowski-distance #{'a 'b} #{'a 'c} 2) 0.59))))

(deftest test-lattice-attribute-distance
(let [ctx test-ctx-09
Expand Down Expand Up @@ -245,8 +245,6 @@
(fn [x y] (contains? new-incidence-rel [x y])))
ctx3 (make-context (objects ctx) (attributes ctx)
(fn [x y] (contains? new-incidence-rel2 [x y])))]
(println ctx3)
(println (lattice-object-distance ctx ctx3))
(is (== (lattice-object-distance ctx ctx) 0))
(is (== (lattice-object-distance ctx ctx 2) 0))
(is (== (lattice-object-distance ctx ctx 2 2) 0))
Expand All @@ -259,10 +257,20 @@

(deftest test-conceptual-distance
(let [ctx test-ctx-09
ctx2 (make-context (objects ctx) (attributes ctx))]
k (count (incidence-relation ctx))
new-incidence-rel (set (take (- k 5) (shuffle (incidence-relation ctx))))
new-incidence-rel2 (set (take (- k 5) (incidence-relation ctx)))
ctx2 (make-context (objects ctx) (attributes ctx)
(fn [x y] (contains? new-incidence-rel [x y])))
ctx3 (make-context (objects ctx) (attributes ctx)
(fn [x y] (contains? new-incidence-rel2 [x y])))]
(is (== (lattice-object-distance ctx ctx) 0))
(is (== (lattice-object-distance ctx ctx 2) 0))
(is (== (lattice-object-distance ctx ctx 2 2) 0))))
(is (== (lattice-object-distance ctx ctx 2 2) 0))
(is (== (lattice-object-distance ctx2 ctx2 2 2) 0))
(is (== (lattice-object-distance ctx3 ctx3 2 2) 0))
(is (>= (lattice-object-distance ctx ctx2 2 2) 0))
(is (>= (lattice-object-distance ctx ctx3 2 2) 0))))


;;;
Expand Down

0 comments on commit 43896b7

Please sign in to comment.