/*
* 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 .
*/
/*
* LED24.java
* Copyright (C) 2005-2012 University of Waikato, Hamilton, New Zealand
*
*/
package weka.datagenerators.classifiers.classification;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Random;
import java.util.Vector;
import weka.core.Attribute;
import weka.core.DenseInstance;
import weka.core.Instance;
import weka.core.Instances;
import weka.core.Option;
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.datagenerators.ClassificationGenerator;
/**
* This generator produces data for a display with 7
* LEDs. The original output consists of 10 concepts and 7 boolean attributes.
* Here, in addition to the 7 necessary boolean attributes, 17 other, irrelevant
* boolean attributes with random values are added to make it harder. By default
* 10 percent of noise are added to the data.
*
* More information can be found here:
* L. Breiman J.H. Friedman R.A. Olshen, C.J. Stone (1984). Classification and
* Regression Trees. Belmont, California. URL
* http://www.ics.uci.edu/~mlearn/databases/led-display-creator/.
*
*
*
* Link:
* http:/
* /www.ics.uci.edu/~mlearn/databases/led-display-creator/
*
*
* BibTeX:
*
*
* @inbook{Olshen1984,
* address = {Belmont, California},
* author = {L. Breiman J.H. Friedman R.A. Olshen and C.J. Stone},
* pages = {43-49},
* publisher = {Wadsworth International Group},
* title = {Classification and Regression Trees},
* year = {1984},
* ISBN = {0412048418},
* URL = {http://www.ics.uci.edu/\~mlearn/databases/led-display-creator/}
* }
*
*
*
*
* Valid options are:
*
*
*
* -h
* Prints this help.
*
*
*
* -o <file>
* The name of the output file, otherwise the generated data is
* printed to stdout.
*
*
*
* -r <name>
* The name of the relation.
*
*
*
* -d
* Whether to print debug informations.
*
*
*
* -S
* The seed for random function (default 1)
*
*
*
* -n <num>
* The number of examples to generate (default 100)
*
*
*
* -N <num>
* The noise percentage. (default 10.0)
*
*
*
*
* @author Richard Kirkby (rkirkby at cs dot waikato dot ac dot nz)
* @author FracPete (fracpete at waikato dot ac dot nz)
* @version $Revision: 10203 $
*/
public class LED24 extends ClassificationGenerator implements
TechnicalInformationHandler {
/** for serialization */
static final long serialVersionUID = -7880209100415868737L;
/** the noise rate */
protected double m_NoisePercent;
/** the 7-bit LEDs */
protected static final int m_originalInstances[][] = {
{ 1, 1, 1, 0, 1, 1, 1 }, { 0, 0, 1, 0, 0, 1, 0 }, { 1, 0, 1, 1, 1, 0, 1 },
{ 1, 0, 1, 1, 0, 1, 1 }, { 0, 1, 1, 1, 0, 1, 0 }, { 1, 1, 0, 1, 0, 1, 1 },
{ 1, 1, 0, 1, 1, 1, 1 }, { 1, 0, 1, 0, 0, 1, 0 }, { 1, 1, 1, 1, 1, 1, 1 },
{ 1, 1, 1, 1, 0, 1, 1 } };
/** used for generating the output, i.e., the additional noise attributes */
protected int m_numIrrelevantAttributes = 17;
/**
* initializes the generator with default values
*/
public LED24() {
super();
setNoisePercent(defaultNoisePercent());
}
/**
* Returns a string describing this data generator.
*
* @return a description of the data generator suitable for displaying in the
* explorer/experimenter gui
*/
public String globalInfo() {
return "This generator produces data for a display with 7 LEDs. The original "
+ "output consists of 10 concepts and 7 boolean attributes. Here, in "
+ "addition to the 7 necessary boolean attributes, 17 other, irrelevant "
+ "boolean attributes with random values are added to make it harder. "
+ "By default 10 percent of noise are added to the data.\n"
+ "\n"
+ "More information can be found here:\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;
result = new TechnicalInformation(Type.INBOOK);
result.setValue(Field.AUTHOR,
"L. Breiman J.H. Friedman R.A. Olshen and C.J. Stone");
result.setValue(Field.YEAR, "1984");
result.setValue(Field.TITLE, "Classification and Regression Trees");
result.setValue(Field.PUBLISHER, "Wadsworth International Group");
result.setValue(Field.ADDRESS, "Belmont, California");
result.setValue(Field.PAGES, "43-49");
result.setValue(Field.ISBN, "0412048418");
result.setValue(Field.URL,
"http://www.ics.uci.edu/~mlearn/databases/led-display-creator/");
return result;
}
/**
* Returns an enumeration describing the available options.
*
* @return an enumeration of all the available options
*/
@Override
public Enumeration
Ads help maintain this website.