Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
The Waikato Environment for Knowledge Analysis (WEKA), a machine
learning workbench. This is the stable version. Apart from bugfixes, this version
does not receive any other updates.
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
/*
* M5Base.java
* Copyright (C) 2000-2012 University of Waikato, Hamilton, New Zealand
*
*/
package weka.classifiers.trees.m5;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Random;
import java.util.Vector;
import weka.classifiers.AbstractClassifier;
import weka.classifiers.functions.LinearRegression;
import weka.core.AdditionalMeasureProducer;
import weka.core.Capabilities;
import weka.core.Instance;
import weka.core.Instances;
import weka.core.Option;
import weka.core.TechnicalInformation;
import weka.core.TechnicalInformation.Field;
import weka.core.TechnicalInformation.Type;
import weka.core.TechnicalInformationHandler;
import weka.core.Utils;
import weka.filters.Filter;
import weka.filters.supervised.attribute.NominalToBinary;
import weka.filters.unsupervised.attribute.RemoveUseless;
import weka.filters.unsupervised.attribute.ReplaceMissingValues;
/**
* M5Base. Implements base routines for generating M5 Model trees and rules.
*
*
* The original algorithm M5 was invented by Quinlan:
*
* Quinlan J. R. (1992). Learning with continuous classes. Proceedings of the
* Australian Joint Conference on Artificial Intelligence. 343--348. World
* Scientific, Singapore.
*
*
* Yong Wang made improvements and created M5':
*
* Wang, Y and Witten, I. H. (1997). Induction of model trees for predicting
* continuous classes. Proceedings of the poster papers of the European
* Conference on Machine Learning. University of Economics, Faculty of
* Informatics and Statistics, Prague.
*
*
* Valid options are:
*
*
* -U
* Use unsmoothed predictions.
*
*
* -R
* Build regression tree/rule rather than model tree/rule
*
* @author Mark Hall ([email protected])
* @version $Revision: 12641 $
*/
public abstract class M5Base extends AbstractClassifier implements
AdditionalMeasureProducer, TechnicalInformationHandler {
/** for serialization */
private static final long serialVersionUID = -4022221950191647679L;
/**
* the instances covered by the tree/rules
*/
private Instances m_instances;
/**
* the rule set
*/
protected ArrayList m_ruleSet;
/**
* generate a decision list instead of a single tree.
*/
private boolean m_generateRules;
/**
* use unsmoothed predictions
*/
private boolean m_unsmoothedPredictions;
/**
* filter to fill in missing values
*/
private ReplaceMissingValues m_replaceMissing;
/**
* filter to convert nominal attributes to binary
*/
private NominalToBinary m_nominalToBinary;
/**
* for removing useless attributes
*/
private RemoveUseless m_removeUseless;
/**
* Save instances at each node in an M5 tree for visualization purposes.
*/
protected boolean m_saveInstances = false;
/**
* Make a regression tree/rule instead of a model tree/rule
*/
protected boolean m_regressionTree;
/**
* Do not prune tree/rules
*/
protected boolean m_useUnpruned = false;
/**
* The minimum number of instances to allow at a leaf node
*/
protected double m_minNumInstances = 4;
/**
* Constructor
*/
public M5Base() {
m_generateRules = false;
m_unsmoothedPredictions = false;
m_useUnpruned = false;
m_minNumInstances = 4;
}
/**
* returns information about the classifier
*
* @return a description suitable for displaying in the explorer/experimenter
* gui
*/
public String globalInfo() {
return "M5Base. Implements base routines for generating M5 Model trees and "
+ "rules\n"
+ "The original algorithm M5 was invented by R. Quinlan and Yong Wang "
+ "made improvements.\n\n"
+ "For more information see:\n\n"
+ getTechnicalInformation().toString();
}
/**
* Returns an instance of a TechnicalInformation object, containing detailed
* information about the technical background of this class, e.g., paper
* reference or book this class is based on.
*
* @return the technical information about this class
*/
@Override
public TechnicalInformation getTechnicalInformation() {
TechnicalInformation result;
TechnicalInformation additional;
result = new TechnicalInformation(Type.INPROCEEDINGS);
result.setValue(Field.AUTHOR, "Ross J. Quinlan");
result.setValue(Field.TITLE, "Learning with Continuous Classes");
result.setValue(Field.BOOKTITLE,
"5th Australian Joint Conference on Artificial Intelligence");
result.setValue(Field.YEAR, "1992");
result.setValue(Field.PAGES, "343-348");
result.setValue(Field.PUBLISHER, "World Scientific");
result.setValue(Field.ADDRESS, "Singapore");
additional = result.add(Type.INPROCEEDINGS);
additional.setValue(Field.AUTHOR, "Y. Wang and I. H. Witten");
additional.setValue(Field.TITLE,
"Induction of model trees for predicting continuous classes");
additional.setValue(Field.BOOKTITLE,
"Poster papers of the 9th European Conference on Machine Learning");
additional.setValue(Field.YEAR, "1997");
additional.setValue(Field.PUBLISHER, "Springer");
return result;
}
/**
* Returns an enumeration describing the available options
*
* @return an enumeration of all the available options
*/
@Override
public Enumeration