Repository navigation
Expand file tree
/
Copy pathC5.java
More file actions
75 lines (51 loc) · 2.22 KB
/
Copy pathC5.java
File metadata and controls
75 lines (51 loc) · 2.22 KB
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
/**
* <code>C5</code> class provides an entry-point for the Decision-Tree framework
*
* @author pandit
*
* @version 1.0
*
* Revision Log
*
* Date Version Description
******************************************************************************
* 17th Nov 1.0 First cut at C5
*
* 18th Nov 1.1 Modified code to add extended command-line support
*
* 25th Nov 1.2 Ignored the label in audiology dataset
* Incorporated max-depth argument
* Checked outputs of wrongly classified examples
* Discretized linear and nominal values
******************************************************************************
*/
public class C5 {
private static boolean debug = false;
private static DecisionTree instance;
public C5 () {
super ();
}
public static void main (final String [] args) throws Exception {
if (args.length == 2) {
instance = new DecisionTree (args[0], args[1], "SPLIT", 3, debug);
} else if (args.length == 3) {
// Determine what is passed as the 3rd argument - depth or the test-set-filename
// (since both are optional parameters)
try {
instance = new DecisionTree (args[0], args[1], "SPLIT", Integer.valueOf(args[2]), debug);
} catch (NumberFormatException excp) {
instance = new DecisionTree (args[0], args[1], args[2], 3, debug);
}
} else if (args.length == 4) {
instance = new DecisionTree (args[0], args[1], args[2], Integer.valueOf (args[3]), debug);
} else {
System.out.println ("\nUsage - java C5 <names-File> <training-Set-Filename> [testing-Set-Filename] [max-depth]");
System.out.println ("\n[Optional] - [testing-Set-Filename] - defaults to 1/3rd of training-file sampled randomly");
System.out.println ("\n[Optional] - [max-depth] - defaults to 3 | Enter a large value (like 100) to make it redundant");
System.out.println ("\nNote: In case you're not providing any of the optional parameters, you needn't worry about the order; as in whether [max-depth] can come as the 3rd argument in case [testing-Set-Filename] isn't present. The framework will take care of this :-)");
System.exit (0);
}
instance.process ();
Utils.waitHere ("Press a key to exit");
}
}