M5Rules.java
Upload User: rhdiban
Upload Date: 2013-08-09
Package Size: 15085k
Code Size: 2k
Category:

Windows Develop

Development Platform:

Java

  1. /*
  2.  *    M5Rules.java
  3.  *    Copyright (C) 2001 Mark Hall
  4.  *
  5.  *    This program is free software; you can redistribute it and/or modify
  6.  *    it under the terms of the GNU General Public License as published by
  7.  *    the Free Software Foundation; either version 2 of the License, or
  8.  *    (at your option) any later version.
  9.  *
  10.  *    This program is distributed in the hope that it will be useful,
  11.  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.  *    GNU General Public License for more details.
  14.  *
  15.  *    You should have received a copy of the GNU General Public License
  16.  *    along with this program; if not, write to the Free Software
  17.  *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  */
  19. package weka.classifiers.rules;
  20. import java.io.*;
  21. import java.util.*;
  22. import weka.core.*;
  23. import weka.classifiers.trees.m5.*;
  24. /**
  25.  * M5 Rules. Implements routines
  26.  * for generating a decision list using M5 Model trees and the approach
  27.  * used by the PART algorithm. <p>
  28.  *
  29.  * Valid options are:<p>
  30.  * 
  31.  * -U <br>
  32.  * Use unsmoothed predictions. <p>
  33.  *
  34.  * @author <a href="mailto:mhall@cs.waikato.ac.nz">Mark Hall</a>
  35.  * @version $Revision: 1.1 $
  36.  */
  37. public class M5Rules extends M5Base {
  38.   public M5Rules() {
  39.     super();
  40.     setGenerateRules(true);
  41.   }
  42.   /**
  43.    * Main method by which this class can be tested
  44.    * 
  45.    * @param args an array of options
  46.    */
  47.   public static void main(String[] args) {
  48.     try {
  49.       System.out.println(weka.classifiers.Evaluation.evaluateModel(
  50.  new M5Rules(), 
  51.  args));
  52.     } catch (Exception e) {
  53.       System.err.println(e.getMessage());
  54.       e.printStackTrace();
  55.     } 
  56.   } 
  57. }