Skip to content

Commit ee2d09a

Browse files
committed
Merge branch 'master' into dev
2 parents a966e75 + f233457 commit ee2d09a

6 files changed

Lines changed: 41 additions & 17 deletions

File tree

.github/workflows/update-deps-lock.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v3
1414
- uses: DeterminateSystems/nix-installer-action@v4
15-
- uses: DeterminateSystems/magic-nix-cache-action@v2
15+
- uses: DeterminateSystems/magic-nix-cache-action@v3
1616
- name: Update deps-lock
1717
run: nix run .#deps-lock
1818

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ would appreciate if you use the following reference.
9595

9696
## License
9797

98-
Copyright ⓒ 2009—2018 Daniel Borchmann, 2018–2024 Tom Hanika
98+
Copyright ⓒ 2009—2018 Daniel Borchmann, 2018—2025 Tom Hanika
9999

100100
Distributed under the Eclipse Public License.
101101

project.clj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,11 @@
5454
:dependencies [[javax.servlet/servlet-api "2.5"]
5555
[ring/ring-mock "0.4.0"]
5656
[nrepl/nrepl "1.1.2"]
57-
[com.clojure-goes-fast/clj-async-profiler "1.2.2"]]
57+
[com.clojure-goes-fast/clj-async-profiler "1.6.1"]
58+
[com.taoensso/tufte "2.7.0"]]
5859
:plugins [[lein-aot-order "0.1.0"]]
5960
:javac-options ["-Xlint:deprecation" "-Xlint:unchecked"]
60-
:jvm-opts ["-Djdk.attach.allowAttachSelf"]}}
61+
:jvm-opts ["-Djdk.attach.allowAttachSelf=true"]}}
6162
:keep-non-project-classes true
6263
:source-paths ["src/main/clojure" "src/test/clojure"]
6364
:java-source-paths ["src/main/java"]

src/main/clojure/conexp/fca/random_contexts.clj

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,25 @@
5353
obj_att_nums))))
5454

5555

56+
;; (defmethod make-context-from-attribute-numbers-per-object :att-coll-obj-coll
57+
;; [att obj obj_att_nums]
58+
;; (let [matrix (flatten (map #(shuffle (into (vec (take % (repeat 1)))
59+
;; (vec (take (- (count att) %) (repeat 0))))) obj_att_nums))]
60+
;; (contexts/make-context-from-matrix
61+
;; (into [] obj)
62+
;; (into [] att)
63+
;; matrix)))
64+
5665
(defmethod make-context-from-attribute-numbers-per-object :att-coll-obj-coll
5766
[att obj obj_att_nums]
58-
(let [matrix (flatten (map #(shuffle (into (vec (take % (repeat 1)))
59-
(vec (take (- (count att) %) (repeat 0))))) obj_att_nums))]
67+
(let [att-count (count att)
68+
matrix (mapcat #(shuffle (concat (repeat % 1)
69+
(repeat (- att-count %) 0)))
70+
obj_att_nums)]
6071
(contexts/make-context-from-matrix
6172
(into [] obj)
6273
(into [] att)
63-
matrix)))
74+
(flatten matrix))))
6475

6576

6677
(defmethod make-context-from-attribute-numbers-per-object :att-coll-obj-num
@@ -276,10 +287,12 @@
276287
(let [attr (contexts/attributes ctx)
277288
objects (contexts/objects ctx)
278289
num_objects (count objects)
279-
freq (frequencies (map #(count (contexts/object-derivation ctx [%])) objects))
280-
probabilities (into {} (for [[k v] freq] [k (/ v (reduce + (vals freq)))]))
281-
cat_distr (createCategoricalDistribution probabilities)]
282-
(makeContext attr objects (for [i (range num_objects)] (.sample cat_distr)))))
290+
freq (frequencies (pmap #(count (contexts/object-derivation ctx [%])) objects))
291+
valsum (reduce + (vals freq))
292+
probabilities (into {} (for [[k v] freq] [k (/ v valsum)]))
293+
cat_distr (createCategoricalDistribution probabilities)
294+
samples (for [i (range num_objects)] (.sample cat_distr))]
295+
(makeContext attr objects samples )))
283296

284297

285298
(defn imitate-context-with-cointoss

src/main/clojure/conexp/io/lattices.clj

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,22 @@
5555
(defn lattice->json
5656
"Returns a concept lattice, consisting of the base set and order, in json format."
5757
[lat]
58-
{:nodes (base-set lat)
59-
:edges (set-of [x y]
60-
[x (base-set lat)
61-
y (base-set lat)
62-
:when ((order lat) [x y])])})
58+
(let [m (order lat)
59+
bvec (vec (base-set lat))
60+
m-fn (if (fn? m) m (fn [x y] (get-in m [x y])))]
61+
{:nodes bvec
62+
:edges
63+
(persistent!
64+
(reduce (fn [acc arg1]
65+
(reduce (fn [a arg2]
66+
(if (m-fn arg1 arg2)
67+
(conj! a [arg1 arg2])
68+
a))
69+
acc
70+
bvec))
71+
(transient [])
72+
bvec))}))
73+
6374

6475
(defn- json->concept
6576
"Returns a vector containing both extent and intent."

src/test/clojure/conexp/fca/fuzzy/fca_test.clj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
0.2 0.9 0.7 0.5 1.0 0.6,
5050
1.0 1.0 0.8 1.0 1.0 0.5]))
5151

52-
5352
(deftest test-mv-to-fuzzy
5453

5554
(is (= (mv->fuzzy-context-nc mvctx) fctx))

0 commit comments

Comments
 (0)