티스토리 툴바


I did not get anything meaningful from WEKA results, association rules. 

fortunately, I found why the results was unuseful through googling

-----------------------------
If you specify an item as "no" in the data, its absense will be used in the 
rules. I.e. you'd have rules like if jelly is not bought, then beer is 
likely to be. If instead of "no" you put "?", absense of items in the 
itemsets will not be used to generate rules.

------------------------------

Let's do it. 

크리에이티브 커먼즈 라이선스
Creative Commons License
Posted by 우하하
TAG weka
언젠가 텍스를 쓸날이 올까모르겠지만, 왠지 꾸준하게 관심이 가는 녀석이긴 하다.
그래서, 몇번이고 설치를 해보긴 했지만, 사용해본적은 아직까지 없긴하다.

실제로 논문을 쓸때 시간에 쫓기게 되다보니, 편한 툴을 사용할 수 밖에 없는 것이 나의 현실이다.
하지만, 혹시 아는가? 급한일로 인해 써야할 때가 올지도 모르니.

유명한 해외 논문에서는 템플릿 파일을 제공한다고 하니 거의 이용하면 되겠지만, 한글을 쓰게 된다면 다음의 옵션을 꼭 사용할 것.

\documentclass[a4paper,11pt]{article}
\usepackage{kotex}

OK? 
크리에이티브 커먼즈 라이선스
Creative Commons License
Posted by 우하하
When I read paper about optimization, I have realized that I need tool for LP. Fortunately I found a tool which was used in several papers. It's called "LP Solve" which is licensed by LGPL

Reference : http://lpsolve.sourceforge.net/5.5/
 
크리에이티브 커먼즈 라이선스
Creative Commons License
Posted by 우하하
I made text classifier using naive baysian filter

But, I don't know that I am right.

Anyway, My object function is Pr (C|D) = P (C) * P(D|C)
C is category
D is document which is composed with many words.

for example,

 Doc w1  w2  category
1 10 200  c1 
200  c2 
3 300  c2 

P(C) is P(c1) and P(c2). P(c1) = 1/3. P(c2)=2/3

P(D|C) is P(w1|C)*P(w2|C)


;;      w1 w2 w3 w4
(def W {:C1 [[1 1 0 0], [1 0 0 0], [0 1 0 0]] 
:C2 [[0 0 1 1], [0 0 0 1]]})
(def D3 [0 1 0 0])

;; object fuction : Pr(C|D) = P(C) * P(D|C)
(defn Pr-C [db class]
  "Identify Pr(Class)"
     (let [totalcount (apply + (for [x (keys db)] (count (db x))))]
       (/ (count (db class)) totalcount)))

(defn word-count-in-category [db category]
  (apply map + (db category)))

(defn sum-in-category [db category]
  (apply + (word-count-in-category db category)))

;P(D|C)=P(w1|C)P(w2|C)...P(wn|C)
(defn Pr-D-C [db category]
  "transfor P(x|C)"
  (let [word-count (word-count-in-category db category)]
    (map #(/ (+ % 1) (+ (sum-in-category db category) (count word-count))) word-count)))
 
;(rank-list W [0 1 2 3] :C1)
;(rank-list W [0 1] :C1)
(defn classify [db word-indexs category]
  (let [s1 (for [i word-indexs] (nth (Pr-D-C db category) i))]
    (apply * (Pr-C db category) s1)))

크리에이티브 커먼즈 라이선스
Creative Commons License
Posted by 우하하
Hi guys

Today I made make-line fuction using processing. But we don't need to processing library directly. Because incanter which is R-like statistic tool on JVM implemented by clojure has already processing library. 

If you have already incanter jar in your classpath, It was done.



(ns dgu.alg.visualize-path
  (:use [incanter core processing]))

(def x '(0 50 50 149 150 182 108 151 149 213 242 246 322 324 246 0 324 325 244 245 325 323 213 490 489 489 487 364 432 400 0 402 401 402 364 401 444 497 572 602 567 538 528 641 0 0 0 680 680 0 602 0 573 575 680 629 631 538 575 573 364 393 427 461 495 517 364 396 444 490 517 495 461 427 393 0 0 0 0 0 0 0 0 364 416 465 500 538 470 419 364 397 443 497 517 490 444 396 364 410 445 403 0 0 0 0 0 0 0 0 0 0 0 0 0 403 445 494 517 493 456 401 538 567 582 599 582 629 644 660 0 675 691 0 0 0 0 459 497 517 490 538 573 574 680 629 631 680 631 631 680 631 632 0 0 0 171 199 227 0 283 311 339 364 394 0 0 507 285 0 0 142 170 198 227 254 282 311 339 367 0 0 0 0 297 322 330 364 297 322 330 364 340 283 313 340 255 0 229 0 0 0 0 0 0 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 198 198 274 274 274 527 685))

(def y '(0 568 593 556 593 593 593 509 541 476 463 493 463 493 509 0 509 541 556 593 556 593 593 509 540 558 593 556 558 593 0 509 463 493 479 449 449 449 509 549 593 540 593 593 0 0 0 523 579 0 477 0 313 345 329 345 313 370 358 391 436 426 426 426 426 436 401 391 391 391 406 413 413 413 413 0 0 0 0 0 0 0 0 334 325 325 325 334 345 345 367 358 358 358 370 379 379 379 158 138 157 168 0 0 0 0 0 0 0 0 0 0 0 0 0 184 184 184 194 209 209 209 244 238 209 242 279 242 209 242 0 209 242 0 0 0 0 478 463 478 493 426 406 436 375 358 391 423 406 436 476 463 493 0 0 0 138 138 138 0 138 138 138 138 138 0 0 138 593 0 0 36 36 36 36 36 36 36 36 36 0 0 0 0 177 177 177 184 245 245 245 244 279 379 379 379 379 0 379 0 0 0 0 0 0 235 255 264 284 294 314 324 344 353 373 383 403 412 432 442 463 574 525 574 525 478 296 296))



(def loc-of-ap (map #(vector %1 %2) x y))

;0207
(def list-of-traces '((5  22  168  21  27  16  60  66  90  83  191  192  122  21 168  5)
(5  22  19  168  20  16  17  21  41  65  94  87  87  85  83  196  198)
(5 22 168 42 41 43 47 152 50 143 146 58 94 141 140 16 7)
(5 22  168  16  152  52  118  167  47  149  37  138  32  10)
(5  22  168  21  42  41  43  47  54  52  122  100  164  162  161  160  173)
 ))


;0209
(def list-of-traces '((1 168 21 41 47 151 50 149 151 70 196 198 214) (1 70 87 100 163 162 161 160 158 156 213) (5 168 21 42 139 70 94 87 192 213) (1 9 10 12 60 83 191 189 190 186 184 185 185 184 187 163 192 74 61 74 60 10 196 98 163 161 184 214) (1 5 21 41 43 94 65 139 42 26 168 19 5 4 213)))

(def list-of-traces '((1 5 21 41 43 94 65 139 42 26 168 19 5 4 213)))

;0211
(def list-of-traces '((1 158 160 98 163 100 118 52 56 122 118 167 100 163 161 160 156 214) (1 168 21 41 43 47 54 56 52 83 90 195 214) (1 5 22 19 168 41 43 48 47 148 54 118 100 158 214) (1 5 21 28 41 50 100 163 98 187 192 214) (1 168 21 65 57 163 161 160 158 156 214)))

(def list-of-traces '((1 158 160 98 163 100 118 52 56 122 118 167 100 163 161 160 156 214)))



(defn extraction-from-list-traces [from-to-line] 
  (for [[f t] from-to-line]
    (flatten (list (nth loc-of-ap (int f)) (nth loc-of-ap (int t))))))


(def s (map extraction-from-list-traces (map #(partition 2 1 %) list-of-traces)))

(defn make-path-line [sktch path-line color]
  (doseq [[x1 y1 x2 y2] path-line]
    (.stroke sktch color)
    (.line sktch x1 (- y1 25) x2 (- y2 25))))

(defn make-path-ellipse [sktch path-line gray]
  (doseq [[x1 y1 x2 y2] path-line]
;    (.fill sktch gray)
    (.ellipse sktch x2 (- y2 25) 10 10)))

(def map-image (ref nil))


(def z (zipmap [(color (rand-int 255) (rand-int 255) (rand-int 255))
(color (rand-int 255) (rand-int 255) (rand-int 255)) (color (rand-int 255) (rand-int 255) (rand-int 255)) (color (rand-int 255) (rand-int 255) (rand-int 255)) (color (rand-int 255) (rand-int 255) (rand-int 255))] s))

(defn view-path [s]
  (let [z (zipmap [   (color 242 24 75)
     (color 27 24 242)
     (color 24 252 51)
     (color 227 242 24)
     (color 0 0 0)] s)
  sktch (sketch
 (setup []
(doto this
  (size 724 641)
  (stroke-weight 5)
  (framerate 3)
  smooth
  (dosync (ref-set map-image (load-image this "d:/dev/LCSExt/SPAbackground_photoshop.jpg")))))
   
 (draw []
(doto this
 (image @map-image 0 0 724 641) 
 (fill 0 121 184 5))
(doseq [s z] 
 (make-path-line this (second s) (first s)))
(doseq [s z]
 (make-path-ellipse this (second  s) (first s)))))]
       (view sktch :size [724 641])))

(view-path s)




(def sktch (sketch
    (setup []
   (doto this
     (size 724 641)
     (stroke-weight 2)
     (framerate 3)
     smooth
     (dosync (ref-set map-image (load-image this "d:/dev/LCSExt/SPAbackground_photoshop.jpg")))))
   
    (draw []
  (doto this
    (image @map-image 0 0) 
    (fill 0 121 184 5))
  (doseq [s z] 
    (make-path-line this (second s) (first s)))
  (doseq [s z]
    (make-path-ellipse this (second  s) (first s))))))



(view sktch)



It's all.
크리에이티브 커먼즈 라이선스
Creative Commons License
Posted by 우하하