Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 116 lines (87 sloc) 3.317 kb
6596a59 Readme in english
Mihai Maruseac authored
1 ID3 classifier
2 ==============
3
4 A. About
5 ........
6
7 This is a homework for the Automatic Learning Course, a course I am taking
8 right now at my University.
9
10 We had to use the ID3 algorithm to classify some examples. The training set
11 consisted of examples containing discrete and integer valued attributes. The
12 examples might be affected by errors but on a limited scale: at most, only two
13 attributes will be missing.
14
15 The only thing that this assignment doesn't do is treating the missing
16 attributes by using ID3 to guess their exact values.
17
18 Although I wanted to use Haskell for this assignment, it wasn't possible when
19 I started coding. It became available as an option when I had done half of the
20 assignment, thus it is still done in C.
21
22 B. Usage
23 ........
24
25 After running ``make``, you can use ``make tests`` to do all the regression
26 tests or use the executable (see each section below for more details):
27
bb83078 Readme in english fixed again
Mihai Maruseac authored
28 * ``./id3 l description examples classifier`` can be used to learn a new classifier
29 * ``./id3 g classifier`` can be used to output the classifier in a variety of formats
6596a59 Readme in english
Mihai Maruseac authored
30 * ``./id3 c classifier test`` can be used to classify new examples
31
0ca94d4 Readme in english fixed
Mihai Maruseac authored
32 If this seems a little confusing, try looking at ``call_overview.png`` in the
33 ``doc`` folder.
6596a59 Readme in english
Mihai Maruseac authored
34
35 B.1. Learning phase
36 ```````````````````
37
38 The learning process must be started with three files:
bb83078 Readme in english fixed again
Mihai Maruseac authored
39
40 * one describing the instance of the problem (in the ``tests`` folder it is called ``atribute.txt``)
6596a59 Readme in english
Mihai Maruseac authored
41 * one describing the learning set (called ``invatare.txt``)
42 * one in which to store the classifier.
43
44 Also, the learning phase can be informed about how to treat numeric attributes:
45 either by doing a binary discretization or a full discretization based on the
46 Minimum Description Length Principle. Another important flag controls how to
47 fill in the missing values: by using probability theory or statistics (majority
48 of attributes).
49
50 For example, all of the following are valid calls::
51
52 ./id3 l attribute learn dump
53 ./id3 l -ndiv -mprb attribute learn dump
54 ./id3 l -mprb attribute learn dump
55
56 B.2. The graphing phase
57 ```````````````````````
58
59 The classifier can be outputed in a variety of formats.
60
61 One user may prefer using simple ASCII display, like this::
62
63 $./id3 g dump
64 outlook = sunny
65 humidity < 80
66 ==> C1
67 humidity >= 80
68 ==> C2
69 outlook = overcast
70 ==> C1
71 outlook = rain
72 windy = true
73 ==> C2
74 windy = false
75 ==> C1
76
77 Or, using ``dot`` to obtain PNGs::
78
79 $./id3 g -gdot dump | dot -Tpng > out.png
80
81 Or, some user may want to place the classifier in a Scheme function::
82
83 $ ./id3 g -gscheme tests/1/out_div_maj
84 (cond
85 (
86 ((eqv? outlook 'sunny)
87 (cond
88 (
89 ((>= humidity 80) 'C1)
90 ((< humidity 80) 'C1)
91 )
92 )
93 )
94 ((eqv? outlook 'overcast) 'C1)
95 ((eqv? outlook 'rain)
96 (cond
97 (
98 ((eqv? windy 'true) 'C2)
99 ((eqv? windy 'false) 'C1)
100 )
101 )
102 )
103 )
104 )
105
106 B.3. The testing (classifying) phase
107 ````````````````````````````````````
108
109 This phase has no flags (as of now), you only have to give the classifier and the example file (optionally the output file, too).
110
111 C. The code
112 ...........
113
0ca94d4 Readme in english fixed
Mihai Maruseac authored
114 A quick overview of the code can be obtained by running ``make doc`` with ``Doxygen`` and ``Graphviz`` installed. If not, looking at ``fct_overview.png`` from the ``doc`` folder may help.
6596a59 Readme in english
Mihai Maruseac authored
115
Something went wrong with that request. Please try again.