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 version represents the developer version, the
"bleeding edge" of development, you could say. New functionality gets added
to this version.
/*
* 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 .
*/
/*
* RandomSubSpace.java
* Copyright (C) 2006-2012 University of Waikato, Hamilton, New Zealand
*
*/
package weka.classifiers.meta;
import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Random;
import java.util.Vector;
import weka.classifiers.Classifier;
import weka.classifiers.RandomizableParallelIteratedSingleClassifierEnhancer;
import weka.core.Instance;
import weka.core.Instances;
import weka.core.Option;
import weka.core.Randomizable;
import weka.core.RevisionUtils;
import weka.core.TechnicalInformation;
import weka.core.TechnicalInformation.Field;
import weka.core.TechnicalInformation.Type;
import weka.core.TechnicalInformationHandler;
import weka.core.Utils;
import weka.core.WeightedInstancesHandler;
import weka.filters.unsupervised.attribute.Remove;
/**
* This method constructs a decision tree based classifier that maintains highest accuracy on training data and improves on generalization accuracy as it grows in complexity. The classifier consists of multiple trees constructed systematically by pseudorandomly selecting subsets of components of the feature vector, that is, trees constructed in randomly chosen subspaces.
*
* For more information, see
*
* Tin Kam Ho (1998). The Random Subspace Method for Constructing Decision Forests. IEEE Transactions on Pattern Analysis and Machine Intelligence. 20(8):832-844. URL http://citeseer.ist.psu.edu/ho98random.html.
*
*
* BibTeX:
*
* @article{Ho1998,
* author = {Tin Kam Ho},
* journal = {IEEE Transactions on Pattern Analysis and Machine Intelligence},
* number = {8},
* pages = {832-844},
* title = {The Random Subspace Method for Constructing Decision Forests},
* volume = {20},
* year = {1998},
* ISSN = {0162-8828},
* URL = {http://citeseer.ist.psu.edu/ho98random.html}
* }
*
*
*
* Valid options are:
*
*
-P
* Size of each subspace:
* < 1: percentage of the number of attributes
* >=1: absolute number of attributes
*
*
*
-S <num>
* Random number seed.
* (default 1)
*
*
-I <num>
* Number of iterations.
* (default 10)
*
*
-D
* If set, classifier is run in debug mode and
* may output additional info to the console
*
*
-W
* Full name of base classifier.
* (default: weka.classifiers.trees.REPTree)
*
*
* Options specific to classifier weka.classifiers.trees.REPTree:
*
*
*
-M <minimum number of instances>
* Set minimum number of instances per leaf (default 2).
*
*
-V <minimum variance for split>
* Set minimum numeric class variance proportion
* of train variance for split (default 1e-3).
*
*
-N <number of folds>
* Number of folds for reduced error pruning (default 3).
*
*
-S <seed>
* Seed for random data shuffling (default 1).
*
*
-P
* No pruning.
*
*
-L
* Maximum tree depth (default -1, no maximum)
*
*
* Options after -- are passed to the designated classifier.
*
* @author Bernhard Pfahringer ([email protected])
* @author Peter Reutemann ([email protected])
* @version $Revision: 10470 $
*/
public class RandomSubSpace
extends RandomizableParallelIteratedSingleClassifierEnhancer
implements WeightedInstancesHandler, TechnicalInformationHandler {
/** for serialization */
private static final long serialVersionUID = 1278172513912424947L;
/** The size of each bag sample, as a percentage of the training size */
protected double m_SubSpaceSize = 0.5;
/** a ZeroR model in case no model can be built from the data */
protected Classifier m_ZeroR;
/** Training data */
protected Instances m_data;
/**
* Constructor.
*/
public RandomSubSpace() {
super();
m_Classifier = new weka.classifiers.trees.REPTree();
}
/**
* Returns a string describing classifier
*
* @return a description suitable for
* displaying in the explorer/experimenter gui
*/
public String globalInfo() {
return
"This method constructs a decision tree based classifier that "
+ "maintains highest accuracy on training data and improves on "
+ "generalization accuracy as it grows in complexity. The classifier "
+ "consists of multiple trees constructed systematically by "
+ "pseudorandomly selecting subsets of components of the feature vector, "
+ "that is, trees constructed in randomly chosen subspaces.\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
*/
public TechnicalInformation getTechnicalInformation() {
TechnicalInformation result;
result = new TechnicalInformation(Type.ARTICLE);
result.setValue(Field.AUTHOR, "Tin Kam Ho");
result.setValue(Field.YEAR, "1998");
result.setValue(Field.TITLE, "The Random Subspace Method for Constructing Decision Forests");
result.setValue(Field.JOURNAL, "IEEE Transactions on Pattern Analysis and Machine Intelligence");
result.setValue(Field.VOLUME, "20");
result.setValue(Field.NUMBER, "8");
result.setValue(Field.PAGES, "832-844");
result.setValue(Field.URL, "http://citeseer.ist.psu.edu/ho98random.html");
result.setValue(Field.ISSN, "0162-8828");
return result;
}
/**
* String describing default classifier.
*
* @return the default classifier classname
*/
protected String defaultClassifierString() {
return "weka.classifiers.trees.REPTree";
}
/**
* Returns an enumeration describing the available options.
*
* @return an enumeration of all the available options.
*/
public Enumeration