1 | /* |
---|
2 | * This program is free software; you can redistribute it and/or modify |
---|
3 | * it under the terms of the GNU General Public License as published by |
---|
4 | * the Free Software Foundation; either version 2 of the License, or |
---|
5 | * (at your option) any later version. |
---|
6 | * |
---|
7 | * This program is distributed in the hope that it will be useful, |
---|
8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
10 | * GNU General Public License for more details. |
---|
11 | * |
---|
12 | * You should have received a copy of the GNU General Public License |
---|
13 | * along with this program; if not, write to the Free Software |
---|
14 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
15 | */ |
---|
16 | |
---|
17 | /* |
---|
18 | * M5Rules.java |
---|
19 | * Copyright (C) 2001 University of Waikato, Hamilton, New Zealand |
---|
20 | */ |
---|
21 | |
---|
22 | package weka.classifiers.rules; |
---|
23 | |
---|
24 | import weka.classifiers.trees.m5.M5Base; |
---|
25 | import weka.core.RevisionUtils; |
---|
26 | import weka.core.TechnicalInformation; |
---|
27 | import weka.core.TechnicalInformationHandler; |
---|
28 | import weka.core.TechnicalInformation.Field; |
---|
29 | import weka.core.TechnicalInformation.Type; |
---|
30 | |
---|
31 | /** |
---|
32 | <!-- globalinfo-start --> |
---|
33 | * Generates a decision list for regression problems using separate-and-conquer. In each iteration it builds a model tree using M5 and makes the "best" leaf into a rule.<br/> |
---|
34 | * <br/> |
---|
35 | * For more information see:<br/> |
---|
36 | * <br/> |
---|
37 | * Geoffrey Holmes, Mark Hall, Eibe Frank: Generating Rule Sets from Model Trees. In: Twelfth Australian Joint Conference on Artificial Intelligence, 1-12, 1999.<br/> |
---|
38 | * <br/> |
---|
39 | * Ross J. Quinlan: Learning with Continuous Classes. In: 5th Australian Joint Conference on Artificial Intelligence, Singapore, 343-348, 1992.<br/> |
---|
40 | * <br/> |
---|
41 | * Y. Wang, I. H. Witten: Induction of model trees for predicting continuous classes. In: Poster papers of the 9th European Conference on Machine Learning, 1997. |
---|
42 | * <p/> |
---|
43 | <!-- globalinfo-end --> |
---|
44 | * |
---|
45 | <!-- technical-bibtex-start --> |
---|
46 | * BibTeX: |
---|
47 | * <pre> |
---|
48 | * @inproceedings{Holmes1999, |
---|
49 | * author = {Geoffrey Holmes and Mark Hall and Eibe Frank}, |
---|
50 | * booktitle = {Twelfth Australian Joint Conference on Artificial Intelligence}, |
---|
51 | * pages = {1-12}, |
---|
52 | * publisher = {Springer}, |
---|
53 | * title = {Generating Rule Sets from Model Trees}, |
---|
54 | * year = {1999} |
---|
55 | * } |
---|
56 | * |
---|
57 | * @inproceedings{Quinlan1992, |
---|
58 | * address = {Singapore}, |
---|
59 | * author = {Ross J. Quinlan}, |
---|
60 | * booktitle = {5th Australian Joint Conference on Artificial Intelligence}, |
---|
61 | * pages = {343-348}, |
---|
62 | * publisher = {World Scientific}, |
---|
63 | * title = {Learning with Continuous Classes}, |
---|
64 | * year = {1992} |
---|
65 | * } |
---|
66 | * |
---|
67 | * @inproceedings{Wang1997, |
---|
68 | * author = {Y. Wang and I. H. Witten}, |
---|
69 | * booktitle = {Poster papers of the 9th European Conference on Machine Learning}, |
---|
70 | * publisher = {Springer}, |
---|
71 | * title = {Induction of model trees for predicting continuous classes}, |
---|
72 | * year = {1997} |
---|
73 | * } |
---|
74 | * </pre> |
---|
75 | * <p/> |
---|
76 | <!-- technical-bibtex-end --> |
---|
77 | * |
---|
78 | <!-- options-start --> |
---|
79 | * Valid options are: <p/> |
---|
80 | * |
---|
81 | * <pre> -N |
---|
82 | * Use unpruned tree/rules</pre> |
---|
83 | * |
---|
84 | * <pre> -U |
---|
85 | * Use unsmoothed predictions</pre> |
---|
86 | * |
---|
87 | * <pre> -R |
---|
88 | * Build regression tree/rule rather than a model tree/rule</pre> |
---|
89 | * |
---|
90 | * <pre> -M <minimum number of instances> |
---|
91 | * Set minimum number of instances per leaf |
---|
92 | * (default 4)</pre> |
---|
93 | * |
---|
94 | <!-- options-end --> |
---|
95 | * |
---|
96 | * @author <a href="mailto:mhall@cs.waikato.ac.nz">Mark Hall</a> |
---|
97 | * @version $Revision: 1.11 $ |
---|
98 | */ |
---|
99 | public class M5Rules |
---|
100 | extends M5Base |
---|
101 | implements TechnicalInformationHandler { |
---|
102 | |
---|
103 | /** for serialization */ |
---|
104 | static final long serialVersionUID = -1746114858746563180L; |
---|
105 | |
---|
106 | /** |
---|
107 | * Returns a string describing classifier |
---|
108 | * @return a description suitable for |
---|
109 | * displaying in the explorer/experimenter gui |
---|
110 | */ |
---|
111 | public String globalInfo() { |
---|
112 | |
---|
113 | return "Generates a decision list for regression problems using " |
---|
114 | + "separate-and-conquer. In each iteration it builds a " |
---|
115 | + "model tree using M5 and makes the \"best\" " |
---|
116 | + "leaf into a rule.\n\n" |
---|
117 | + "For more information see:\n\n" |
---|
118 | + getTechnicalInformation().toString(); |
---|
119 | } |
---|
120 | |
---|
121 | /** |
---|
122 | * Constructor |
---|
123 | */ |
---|
124 | public M5Rules() { |
---|
125 | super(); |
---|
126 | setGenerateRules(true); |
---|
127 | } |
---|
128 | |
---|
129 | /** |
---|
130 | * Returns an instance of a TechnicalInformation object, containing |
---|
131 | * detailed information about the technical background of this class, |
---|
132 | * e.g., paper reference or book this class is based on. |
---|
133 | * |
---|
134 | * @return the technical information about this class |
---|
135 | */ |
---|
136 | public TechnicalInformation getTechnicalInformation() { |
---|
137 | TechnicalInformation result; |
---|
138 | |
---|
139 | result = new TechnicalInformation(Type.INPROCEEDINGS); |
---|
140 | result.setValue(Field.AUTHOR, "Geoffrey Holmes and Mark Hall and Eibe Frank"); |
---|
141 | result.setValue(Field.TITLE, "Generating Rule Sets from Model Trees"); |
---|
142 | result.setValue(Field.BOOKTITLE, "Twelfth Australian Joint Conference on Artificial Intelligence"); |
---|
143 | result.setValue(Field.YEAR, "1999"); |
---|
144 | result.setValue(Field.PAGES, "1-12"); |
---|
145 | result.setValue(Field.PUBLISHER, "Springer"); |
---|
146 | |
---|
147 | result.add(super.getTechnicalInformation()); |
---|
148 | |
---|
149 | return result; |
---|
150 | } |
---|
151 | |
---|
152 | /** |
---|
153 | * Returns the revision string. |
---|
154 | * |
---|
155 | * @return the revision |
---|
156 | */ |
---|
157 | public String getRevision() { |
---|
158 | return RevisionUtils.extract("$Revision: 1.11 $"); |
---|
159 | } |
---|
160 | |
---|
161 | /** |
---|
162 | * Main method by which this class can be tested |
---|
163 | * |
---|
164 | * @param args an array of options |
---|
165 | */ |
---|
166 | public static void main(String[] args) { |
---|
167 | runClassifier(new M5Rules(), args); |
---|
168 | } |
---|
169 | } |
---|