forked from marcliberatore/mallet-lda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.lein-repl-history
500 lines (497 loc) · 20.9 KB
/
.lein-repl-history
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
(lda-readers/->SeqReader the-model)
(def seq-reader (lda-readers/->SeqReader the-model))
(seq-reader/slurp-data [
[1 ["ruby" "lda" "test" "rails"]]
[2 ["python" "web" "django"]]
])
(require '[marcliberatore.mallet.readers :refer [slurp-data]
:as lda-readers])
:as lda-readers]) (require '[marcliberatore.mallet.readers :refer [slurp-data]
:as lda-readers] :reload)
(require '[marcliberatore.mallet.readers :refer [slurp-data] :as lda-readers] :reload)
(slurp-data seq-reader
[
[1 ["ruby" "lda" "test" "rails"]]
[2 ["python" "web" "django"]]
])
(require '[marcliberatore.mallet.readers :refer [slurp-data] :as lda-readers] :reload)
(require '[marcliberatore.mallet.readers :refer [slurp-data] :as lda-readers] :reload)
(slurp-data seq-reader [])
(slurp-data seq-reader)
(doc slurp-data)
(:the-model seq-reader)
(slurp-data seq-reader)
(require '[marcliberatore.mallet.readers :refer [slurp-data] :as lda-readers] :reload-all)
(slurp-data seq-reader)
(slurp-data seq-reader [])
(slurp-data [])
(slurp-data this [])
(slurp-data 1 1)
(slurp-data seq-reader)
(slurp-data seq-reader 1)
(require '[marcliberatore.mallet.lda :as lda])
(require '[marcliberatore.mallet.readers :refer [slurp-data] :as lda-readers] :reload)
(def the-model (lda/make-model))
(def the-model (lda/make-model []))
(def seq-reader (lda-readers/->SeqReader))
(slurp-data seq-reader [[1 ["ruby" "lda"]]])
(lda/add-instances the-model (slurp-data seq-reader [[1 ["ruby" "lda"]]]))
(require '[monger.core :as mg])
(mg/connect!)
(mg/set-db! (mg/get-db "veye_dev"))
(require '[monger.collection :as mc])
(mc/find "products" {:language "Clojure" :prod_key "ztellman/aleph"})
(mc/find-one "products" {:language "Clojure" :prod_key "ztellman/aleph"})
(pprint (mc/find-one "products" {:language "Clojure" :prod_key "ztellman/aleph"}))
(def doc (mc/find-one "products" {:language "Clojure" :prod_key "ztellman/aleph"}))
(def the-doc (mc/find-one "products" {:language "Clojure" :prod_key "ztellman/aleph"}))
(for [[k v] the-doc (print k)]
)
(for [[k v] the-doc] (print k))
(for [[k v] the-doc] k)
(def the-doc (mc/find-one "products" {:language "Clojure" :prod_key "ztellman/aleph"} [:prod]))
the-doc
(def the-doc (mc/find-one "products" {:language "Clojure" :prod_key "ztellman/aleph"}))
(mc/find-one "products" {:language "Clojure" :prod_key "ztellman/aleph"})
(mc/find-one "products" {:language "Clojure" :prod_key "ztellman/aleph"} ["prod"])
(mc/find-one "products" {:language "Clojure" :prod_key "ztellman/aleph"} [":prod_key"])
(mc/find-one "products" {:language "Clojure" :prod_key "ztellman/aleph"} ["prod_key"])
(mc/find-one "products" {:language "Clojure" :prod_key "ztellman/aleph"} [])
(keys the-doc)
(includes? ["a"] "a")
(has? ["a"] "a")
(exists? ["a"] "a")
(includes? ["a"] "a")
(contains? ["a"] "a")
(contains? ["a"] 0)
(contains? #{"a"} 0)
(contains? (set "a") 0)
(contains? (set "a") "a")
(contains? (set "a") "a")
(set "a")
(apply set ["a" "b"]
)
(apply set ["a" "b"])
(apply set ["ab" "bb"])
(apply set "ab" "bb")
(set "ab" "bb")
{"abc" "cde"}
(apply {} ["cd" "vf"])
(apply hash-set ["cd" "vf"])
(apply set ["cd" "vf"])
(apply set (keys the-doc))
(apply hash-set (keys the-doc))
(fields (apply hash-set (keys the-doc)))
(def fields (apply hash-set (keys the-doc)))
(contains? fields "prod_key")
(contains? fields "prod")
(keep #(contains? (hash-set "prod_key" "authors")) fields)
(require '[clojure.string :as string])
(string/split "anb,abc" ",")
(doc string/split)
(string/split "anbc,ab,vb HGS" #"[\s|\,]")
(string/split "anbc,ab,,vb HGS" #"[\s|\,]+")
(map #(%2) {:a 1})
(map #(%) {:a 1})
(map #(print %1) {:a 1})
(map (fn [[k v] the-doc] k) {:a 1})
(map (fn [[k v]] k) {:a 1})
(defn tokenize [item]
(-> item str string/lower-case (string/split #"[\s|\,]+")))
(tokenize "abc, andn andna andnd andndna anandnd.")
(tokenize-doc {:a "abc se, adadf sdad" :b "asca asds, asd as,sd"})
(defn tokenize-doc [the-doc]
(mapcat (fn[[k v]] (tokenize v)))
)
(tokenize-doc {:a "abc se, adadf sdad" :b "asca asds, asd as,sd"})
(defn tokenize-doc [the-doc]
(mapcat (fn[[k v]] (tokenize v))
the-doc))
(tokenize-doc {:a "abc se, adadf sdad" :b "asca asds, asd as,sd"})
(select-keys the-doc ["prod" "lks"])
(select-keys the-doc ["prod_key" "lks"])
(class the-doc)
(require '[marcliberatore.mallet.lda :as lda])
(require '[marcliberatore.mallet.lda :as lda])
(require '[marcliberatore.mallet.lda :as lda])
(require '[marcliberatore.mallet.lda :as lda] :reload)
(def the-model (lda/make-model))
(require '[marcliberatore.mallet.lda :as lda] :reload)
(def the-model (lda/make-model))
(def training-data (make-instances
[
[1 ["ruby" "lda" "test" "rails"]]
[2 ["python" "web" "django"]]
[3 ["c" "http" "server"]]
]))
(def training-data (lda/make-instances
[
[1 ["ruby" "lda" "test" "rails"]]
[2 ["python" "web" "django"]]
[3 ["c" "http" "server"]]
]))
(def training-data (lda/make-instance-list
[
[1 ["ruby" "lda" "test" "rails"]]
[2 ["python" "web" "django"]]
[3 ["c" "http" "server"]]
]))
(class training-data)
(lda/train the-model training-data)
(lda/get-top-words the-model)
(lda/get-top-words the-model 5)
(for [a (take 5 (range 1 5))] a)
(range 1 5)
(for [a (range 1 5), b (range 10, 15)] [a, b])
(for [a (range 1 5), b (iterate inc 0)] [a, b])
(for [a (range 1 5), b (first (iterate inc 0))] [a, b])
(for [a (range 1 5), b (next (iterate inc 0))] [a, b])
(require '[marcliberatore.mallet.lda :as lda] :reload)
(lda/get-top-words the-model 5)
(require '[marcliberatore.mallet.lda :as lda] :reload)
(lda/get-top-words the-model 5)
(require '[marcliberatore.mallet.lda :as lda] :reload)
(lda/get-top-words the-model 5)
(require '[marcliberatore.mallet.lda :as lda] :reload)
(def twords (lda/get-top-words the-model 5))
(get twords 0)
(get twords 1)
(get twords)
(get twords 0)
(count twords)
(class twords)
(class (doall twords))
(get (dorun twords) 0)
(get (vec twords) 0)
(require '[marcliberatore.mallet.lda :as lda] :reload)
(get twords 0)
(def twords (lda/get-top-words the-model 5))
(get (vec twords) 0)
twords
(lda/get-topic-counts 0 0)
(lda/get-topic-counts the-model)
(lda/get-topic-doc-counts the-model)
(.getTopicPropabilities the-model 0)
(.getTopicProbabilities the-model 0)
(into [] (.getTopicProbabilities the-model 0))
(into [] (.getTopicProbabilities the-model 4))
(into [] (.getTopicProbabilities the-model 2))
(require '[marcliberatore.mallet.lda :as lda] :reload)
(require '[marcliberatore.mallet.lda :as lda] :reload-all)
(require '[marcliberatore.mallet.lda :as lda] :reload)
(lda/get-probabilities the-model 0)
(lda/get-topic-probabilities the-model 0)
(sum (lda/get-topic-probabilities the-model 0))
(apply + (lda/get-topic-probabilities the-model 0))
(apply + (lda/get-topic-probabilities the-model 1))
(apply + (lda/get-topic-probabilities the-model 2))
(lda/get-topic-probabilities the-model 3)
(def alphabet (lda/get-alphabet the-model))
(.lookupIndex alphabet "1")
(.lookupIndex alphabet "2")
(.lookupIndex alphabet "3")
(.lookupIndex alphabet "4")
(.lookupIndex alphabet "5")
(.lookupIndex alphabet "1")
(.lookupIndex alphabet 1)
(.lookupObject alphabet 1)
(.lookupObject alphabet 3)
(.lookupObject alphabet 0)
(.lookupObject alphabet 3)
(.lookupObject alphabet 15)
(.lookupObject alphabet 16)
(.lookupObject alphabet 14)
(length [1 2 3])
(len [1 2 3])
(count [1 2 3])
(require '[marcliberatore.mallet.alphabet :as alphabet])
(require '[marcliberatore.mallet.lda :as lda])
(require '[marcliberatore.mallet.utils :as lda-utils])
(require '[marcliberatore.mallet.alphabet :as lda-abc])
(require '[marcliberatore.mallet.alphabet :as lda-abc])
(require '[marcliberatore.mallet.alphabet :as lda-abc] :reload)
(require '[marcliberatore.mallet.alphabet :as lda-abc])
(require '[marcliberatore.mallet.alphabet :as lda-abc] :reload)
w
(require '[marcliberatore.mallet.alphabet :as lda-abc] :reload)
(require '[marcliberatore.mallet.alphabet :as lda-abc] :reload-all)
(class [1,2,3])
(implements [1,2,3])
(protocols [1,2,3])
(require '[marcliberatore.mallet.alphabet :as lda-abc] :reload-all)
(keys (:impls clojure.lang.Counter))
(keys (:impls clojure.lang.Countet))
(keys (:impls clojure.lang.Counted))
(keys (:impls clojure.lang.PersistentMap))
(keys (:impls clojure.lang.ISeq))
(extenders clojure.lang.Counted)
(extenders clojure.lang.ISeq)
(extenders Seq)
(extenders ISeq)
(extenders [])
(class {})
(extenders clojure.lang.PersistentArrayMap)
(extenders clojure.lang.APersistentArrayMap)
(extenders clojure.lang.IPersistentArrayMap)
(extenders clojure.lang.IPersistent)
(extenders clojure.lang.IPersistentCollection)
clojure.lang.IPersistentCollection
(require '[marcliberatore.mallet.alphabet :as lda-abc] :reload-all)
(make-array)
(make-array 1)
(make-array 1 1)
(doc make-array)
(extenders [])
(ancestors [])
(require '[marcliberatore.mallet.alphabet :as lda-abc] :reload-all)
clojure.lang.IPersistentCollection
(require '[marcliberatore.mallet.alphabet :as lda-abc] :reload-all)
clojure.lang.APersistentCollection
(require '[marcliberatore.mallet.alphabet :as lda-abc] :reload-all)
(ancestors [])
(ancestors clojure.lang.PersistentArray)
(ancestors clojure.lang.PersistentHash)
(ancestors clojure.lang.PersistentList)
(require '[marcliberatore.mallet.alphabet :as lda-abc] :reload-all)
ILookup
(require '[marcliberatore.mallet.alphabet :as lda-abc] :reload-all)
(require '[marcliberatore.mallet.instances :as instances])
(require '[marcliberatore.mallet.instance :as instance])
(require '[marcliberatore.mallet.instance :as instance] :reload)
(def the-i (make-instance-list [[1 ["ruby" "rails" "web" "framework"]] [2 ["php" "rss" "feed"]]]))
(def the-i (instance/make-instance-list [[1 ["ruby" "rails" "web" "framework"]] [2 ["php" "rss" "feed"]]]))
(require '[marcliberatore.mallet.instance :as instance] :reload)
(def the-i (instance/make-instance-list [[1 ["ruby" "rails" "web" "framework"]] [2 ["php" "rss" "feed"]]]))
the-i
(.size the-i)
(get-data-alphabet the-i)
(instance/get-data-alphabet the-i)
(.entryClass (instance/get-data-alphabet the-i))
(require '[marcliberatore.mallet.instance :as instance] :reload)
(require '[marcliberatore.mallet.instance :as instance] :reload-all)
the-i
(nth the-i 0)
(def the-is (instance/make-instance-list [[1 ["ruby" "rails" "web" "framework"]] [2 ["php" "rss" "feed"]]]))
(def the-i (nth the-is 0))
(instance/locked? the-i)
(instance/get-data the-i)
(instance/get-name the-i)
(.contains the-i 1)
(.indexOf the-i 1)
(instance/get-target the-i 1)
(instance/get-target the-i)
(.getProperties the-i)
(.getPropertyList the-i)
(.getProperties the-i)
(.getNumericProperty the-i)
(.getNumericProperty the-i 1)
(get-alphabet the-i)
(instance/get-alphabet the-i)
(instance/get-data-alphabet the-i)
(instance/get-target-alphabet the-i)
(instance/lock the-i)
(instance/unlock the-i)
(instance/locked? the-i)
(instance/lock the-i)
(require '[marcliberatore.mallet.instance :as instance :refer [make-instance-list]])
(def training-data (lda/make-instance-list
[
[1 ["ruby" "lda" "test" "rails"]]
[2 ["python" "web" "django"]]
[3 ["c" "http" "server"]]
]))
(def training-data (make-instance-list
[
[1 ["ruby" "lda" "test" "rails"]]
[2 ["python" "web" "django"]]
[3 ["c" "http" "server"]]
]))
(for [the-i (seq trainind-data)] the-i)
(for [the-i (seq training-data)] the-i)
(require '[marcliberatore.mallet.lda :as lda])
(require '[marcliberatore.mallet.utils :as lda-utils])
(require '[marcliberatore.mallet.alphabet :as lda-abc])
(require '[marcliberatore.mallet.instance :as instance :refer [make-instance-list]])
(require '[marcliberatore.mallet.lda :as lda])
(require '[marcliberatore.mallet.lda :as lda] :reload)
(require '[marcliberatore.mallet.lda :as lda])
(require '[marcliberatore.mallet.lda :as lda] :reload)
(require '[marcliberatore.mallet.utils :as lda-utils])
(require '[marcliberatore.mallet.alphabet :as lda-abc])
(require '[marcliberatore.mallet.alphabet :as lda-abc] :reload)
(require '[marcliberatore.mallet.instance :as instance :refer [make-instance-list]])
(def example-data (make-instance-list
[
[1 ["ruby" "lda" "test" "rails"]]
[2 ["python" "web" "django"]]
[3 ["c" "http" "server"]]
[4 ["ruby" "lda" "test" "machine" "learning"]]
]))
(instance/split example-data [0.8 0.8])
(double-array 0.8 0.8)
(instance/split example-data (double-array 0.8 0.8))
(instance/split example-data (double-array 0.8 0.2))
(instance/split example-data (double-array 0.5))
(.size example-data)
(count example-data)
(nth example-data 0)
(first example-data)
(instance/split example-data (doubles 0.5))
(instance/split example-data (doubles [0.5]))
(instance/split example-data 0.5))
(instance/split example-data 0.5)
(instance/split example-data (double 0.5))
(instance/split example-data (doubles 0.5))
(instance/split example-data (double-array 0.5))
(.split example-data 2 2)
(.split example-data (int-array 2 2))
(.splitInOrder example-data (int-array 2 2))
(first (.splitInOrder example-data (int-array 2 2)))
(.split example-data (double-array 1 1))
(.split example-data (double-array 2 1))
(.split example-data (double-array 2.0 1))
(.split example-data (double-array 50 50))
(first (.split example-data (double-array 50 50)))
(first (.split example-data (double-array 1 1)))
(first (.split example-data (double-array 0.5)))
(first (.split example-data (double-array 0.5 0.5)))
(first (.split example-data (double-array 70 30)))
(count (.split example-data (double-array 70 30)))
(count (.split example-data (double-array 2)))
(first (.split example-data (double-array 2)))
(second (.split example-data (double-array 2)))
(second (.split example-data (double-array 4)))
(first (.split example-data (double-array 4)))
(first (.split example-data (double-array 4 4)))
(first (.split example-data (double-array 2 0.5 0.5)))
(first (.split example-data (double-array 2 0.5)))
(first (.split example-data (double-array 2 0.6)))
(first (.split example-data (double-array 2 0.8)))
(first (.split example-data (double-array 2 1)))
(count (.split example-data (double-array 2 1)))
(second (.split example-data (double-array 2 1)))
(second (.split example-data (double-array 2 0.7)))
(second (.split example-data (double-array 2 0.8 0.2)))
(second (.split example-data (double-array 2 0.8)))
(second (.split example-data (double-array 2 1)))
(first (.split example-data (double-array 2 1)))
(first (.split example-data (double-array 2 2)))
(first (.split example-data (double-array 2 4)))
(second (.split example-data (double-array 2 4)))
(apply int-array [1 2 3])
(int-array [1 2 3])
(vec (int-array [1 2 3]))
(.split example-data (double-array [0.5]))
(count (.split example-data (double-array [0.5])))
(count (.split example-data (double-array [0.5 0.5])))
(count (.split example-data (double-array [0.5 0.5 0.5])))
(count (.split example-data (double-array [0.5 0.5 0.5 0.5])))
(first (.split example-data (double-array [0.5 0.5 0.5 0.5])))
(last (.split example-data (double-array [0.5 0.5 0.5 0.5])))
(last (.split example-data (double-array [0.5 0.5 0.5 0.5 0.5])))
(last (.split example-data (double-array [0.5 0.5 0.5 0.5 2])))
(last (.split example-data (double-array [2 2 2 2 2])))
(last (.split example-data (double-array [2 2 2 2])))
(last (.split example-data (double-array [2 2 2 4])))
(last (.split example-data (double-array [0.25 0.75])))
(print 3 3 3 3)
(print 3 3 3 3 ": " 2)
(require '[marcliberatore.mallet.instance :as instance :refer [make-instance-list]])
(require '[marcliberatore.mallet.instance :as instance :refer [make-instance-list]] :reload-all)
(def [a, b] [1, 2])
(def the-splits (instance/split example-data [0.75 0.25]))
(def training-data (first the-split))
(def training-data (first the-splits))
(count training-data)
(def validate-data (last the-splits))
(print "size of training-data: " (count training-data)
"size of validate-data: " (count validate-data))
(def the-model (lda/make-model :num-topics 2 :num-iter 3))
(lda/train the-model training-data)
(lda/get-top-words the-model 5)
(lda/get-topic-probabilities the-model 0)
(def the-estimates (lda/estimate the-model validate-data))
the-estimates
(lda/estimate the-model validate-data)
(require '[marcliberatore.mallet.lda :as lda])
(require '[marcliberatore.mallet.utils :as lda-utils])
(require '[marcliberatore.mallet.alphabet :as lda-abc])
(require '[marcliberatore.mallet.instance :as instance :refer [make-instance-list]])
(def example-data (make-instance-list
[
[1 ["ruby" "lda" "test" "rails"]]
[2 ["python" "web" "django"]]
[3 ["c" "http" "server"]]
[4 ["ruby" "lda" "test" "machine" "learning"]]
]))
(def the-splits (instance/split example-data [0.75 0.25]))
(def training-data (first the-splits))
(def validate-data (last the-splits))
(print "size of training-data: " (count training-data)
"size of validate-data: " (count validate-data))
(def the-model (lda/make-model :num-topics 2 :num-iter 3))
(lda/train the-model training-data)
(lda/get-top-words the-model 5)
(lda/get-topic-probabilities the-model 0) ;;topic probabilities for first training-instance
(lda/estimate the-model validate-data)
(the-inferencer (.getInferencer the-model))
(def the-inferencer (.getInferencer the-model))
the-inferencer
(.getSampledDistribution the-inferencer (first validate-data) 10 1 5)
(require '[marcliberatore.mallet.lda :as lda])
(require '[marcliberatore.mallet.lda :as lda] :reload-all)
(lda/estimate the-model validate-data)
(.numIterations the-model)
(let [{:keys [a b] :or {:a 1 :b 2}} {:a 3}] [a,b])
(let [{:keys [a b] :or {a 1 b 2}} {:a 3}] [a,b])
(let [{:keys [a b] :or {a 1 b 2}} {}] [a,b])
(require '[marcliberatore.mallet.lda :as lda] :reload-all)
(def estimator-settings {:num-iters 10 :thinning 5 :burnin 1})
(lda/estimate the-model validate-data estimator-settings)
(.write the-model (io/as-file "/Users/timosulg/temp/model1.smf"))
(require '[clojure.java.io])
(.write the-model (io/as-file "/Users/timosulg/temp/model1.smf"))
(require '[clojure.java.io :as io])
(.write the-model (io/as-file "/Users/timosulg/temp/model1.smf"))
(require '[marcliberatore.mallet.lda :as lda] :reload-all)
(lda/spit-model the-model "/Users/timosulg/temp/model2.mdl")
(lda/slurp-model the-model "/Users/timosulg/temp/model2.mdl")
(require '[marcliberatore.mallet.lda :as lda] :reload-all)
(lda/slurp-model the-model "/Users/timosulg/temp/model2.mdl")
(require '[marcliberatore.mallet.lda :as lda] :reload-all)
(lda/slurp-model the-model "/Users/timosulg/temp/model2.mdl")
(slurp-model (io/as-file "/Users/timosulg/temp/model2.mdl"))
(lda/slurp-model (io/as-file "/Users/timosulg/temp/model2.mdl"))
(lda/slurp-model (io/as-file "/Users/timosulg/temp/model2.mdl") "")
(require '[marcliberatore.mallet.lda :as lda] :reload-all)
(lda/slurp-model (io/as-file "/Users/timosulg/temp/model2.mdl") "")
(require '[marcliberatore.mallet.lda :as lda] :reload-all)
(lda/slurp-model (io/as-file "/Users/timosulg/temp/model2.mdl") "")
(lda/slurp-model (io/as-file "/Users/timosulg/temp/model2.mdl"))
(require '[marcliberatore.mallet.lda :as lda] :reload-all)
(lda/slurp-model (io/as-file "/Users/timosulg/temp/model2.mdl"))
(require '[marcliberatore.mallet.lda :as lda] :reload-all)
(lda/slurp-model (io/as-file "/Users/timosulg/temp/model2.mdl"))
(require '[clojure.java.io :as io])
(def the-filepath "/Users/mallet/model1.mdl")
(lda/spit-model the-filepath)
(lda/spit-model the-model the-filepath)
(def the-filepath "/Users/timosulg/temp/model1.mdl")
(lda/spit-model the-model the-filepath)
(lda/slurp-model (io/as-file the-filepath)) ;;returns new model objects
(= (class 1) (class 2))
(require '[marcliberatore.mallet.lda :as lda])
(require '[marcliberatore.mallet.instance :as instance :refer [make-instance-list]])
(def example-data (make-instance-list
[
[1 ["ruby" "lda" "test" "rails"]]
[2 ["python" "web" "django"]]
[3 ["c" "http" "server"]]
[4 ["ruby" "lda" "test" "machine" "learning"]]
]))
(def the-model (lda/make-model :num-topics 2 :num-iter 3))
(lda/train-run the-model)
(lda/add-instances the-model example-data)
(lda/train-run the-model)
(make-instance-list [])
(make-instance-list nil)