-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
38 lines (25 loc) · 1.53 KB
/
README
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
# bayesian-classifier
A naive bayesian classifier supporting both traditional classification and Paul Graham's variant outlined in "A Plan for Spam"
## Usage
make-classifier accepts N category names as keywords and returns a classifer:
(def *healthy-sick-classifier* (make-classifier :healthy :sick))
If you wish to use agents or atoms for your concurrency mechanism then by all means, do this:
(def *healthy-sick-classifier-atom* (atom (make-classifier :healthy :sick))
(def *healthy-sick-classifier-agent* (agent (make-classifier :healthy :sick))
Next, you'll want to give it some training data. learn! will throw an exception if you attempt to
classify data into a concept/class that is currently not in the classifer. learn will just roll with this
and create the new concept/class on the fly.
(learn! *healthy-sick-classifier* "fred" :sick)
(swap! learn! *healthy-sick-classifier* "fred" :sick)
(send *healthy-sick-classifier-agent* learn! "fred" :first)
Use one of the support methods to categorize new data. These classifications algo's utilize protocols
to ensure type transparency. They will work seemless with vanilla classifier maps, atoms or agents:
(p-of-class-given-token *healthy-sick-classifier* "betty")
(p-of-class-given-token-graham *healthy-sick-classifier* "mary")
Persisting trained classifiers is trivial:
(save-classifier *healthy-sick-classifer* "chicken.txt")
(load-classifier "chicken.txt")
## Installation
Typical leiningen project rules apply.
## License
Copyright (C) 2010 Do What Thou Wilt Shall Be The Whole Of The Law.