All Downloads are FREE. Search and download functionalities are using the official Maven repository.

weka.classifiers.meta.Stacking Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 3.8.6
Show newest 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 .
 */

/*
 *    Stacking.java
 *    Copyright (C) 1999-2012 University of Waikato, Hamilton, New Zealand
 *
 */

package weka.classifiers.meta;

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.Classifier;
import weka.classifiers.RandomizableParallelMultipleClassifiersCombiner;
import weka.classifiers.rules.ZeroR;
import weka.core.*;
import weka.core.TechnicalInformation.Field;
import weka.core.TechnicalInformation.Type;

/**
 
 * Combines several classifiers using the stacking method. Can do classification or regression.
*
* For more information, see
*
* David H. Wolpert (1992). Stacked generalization. Neural Networks. 5:241-259. *

* * BibTeX: *

 * @article{Wolpert1992,
 *    author = {David H. Wolpert},
 *    journal = {Neural Networks},
 *    pages = {241-259},
 *    publisher = {Pergamon Press},
 *    title = {Stacked generalization},
 *    volume = {5},
 *    year = {1992}
 * }
 * 
*

* * Valid options are:

* *

 -M <scheme specification>
 *  Full name of meta classifier, followed by options.
 *  (default: "weka.classifiers.rules.Zero")
* *
 -X <number of folds>
 *  Sets the number of cross-validation folds.
* *
 -S <num>
 *  Random number seed.
 *  (default 1)
* *
 -B <classifier specification>
 *  Full class name of classifier to include, followed
 *  by scheme options. May be specified multiple times.
 *  (default: "weka.classifiers.rules.ZeroR")
* *
 -D
 *  If set, classifier is run in debug mode and
 *  may output additional info to the console
* * * @author Eibe Frank ([email protected]) * @version $Revision: 12205 $ */ public class Stacking extends RandomizableParallelMultipleClassifiersCombiner implements TechnicalInformationHandler { /** for serialization */ static final long serialVersionUID = 5134738557155845452L; /** The meta classifier */ protected Classifier m_MetaClassifier = new ZeroR(); /** Format for meta data */ protected Instances m_MetaFormat = null; /** Format for base data */ protected Instances m_BaseFormat = null; /** Set the number of folds for the cross-validation */ protected int m_NumFolds = 10; /** * Returns a string describing classifier * @return a description suitable for * displaying in the explorer/experimenter gui */ public String globalInfo() { return "Combines several classifiers using the stacking method. " + "Can do classification or regression.\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, "David H. Wolpert"); result.setValue(Field.YEAR, "1992"); result.setValue(Field.TITLE, "Stacked generalization"); result.setValue(Field.JOURNAL, "Neural Networks"); result.setValue(Field.VOLUME, "5"); result.setValue(Field.PAGES, "241-259"); result.setValue(Field.PUBLISHER, "Pergamon Press"); return result; } /** * Returns an enumeration describing the available options. * * @return an enumeration of all the available options. */ public Enumeration




© 2015 - 2024 Weber Informatics LLC | Privacy Policy