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

weka.filters.unsupervised.attribute.AddNoise 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 breaking 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 .
 */

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

package weka.filters.unsupervised.attribute;

import java.util.Enumeration;
import java.util.Random;
import java.util.Vector;

import weka.core.*;
import weka.core.Capabilities.Capability;
import weka.filters.Filter;
import weka.filters.UnsupervisedFilter;
import weka.gui.ProgrammaticProperty;

/**
 *  An instance filter that changes a percentage of a
 * given attribute's values. The attribute must be nominal. Missing value can be
 * treated as a distinct separate value.
 * 

* * * Valid options are: *

* *

 * -C <col>
 *  Index of the attribute to be changed 
 *  (default last attribute)
 * 
* *
 * -M
 *  Treat missing values as an extra value
 * 
* *
 * -P <num>
 *  Specify the percentage of values that are changed (default 10)
 * 
* *
 * -S <num>
 *  Specify the random number seed (default 1)
 * 
* * * * @author Gabi Schmidberger ([email protected]) * @version $Revision: 14534 $ */ public class AddNoise extends Filter implements UnsupervisedFilter, OptionHandler, Randomizable, WeightedAttributesHandler { /** for serialization */ static final long serialVersionUID = -8499673222857299082L; /** The attribute's index setting. */ private final SingleIndex m_AttIndex = new SingleIndex("last"); /** Flag if missing values are taken as value. */ private boolean m_UseMissing = false; /** The subsample size, percent of original set, default 10% */ private int m_Percent = 10; /** The random number generator seed */ private int m_RandomSeed = 1; /** * Returns a string describing this filter * * @return a description of the filter suitable for displaying in the * explorer/experimenter gui */ public String globalInfo() { return "An instance filter that changes a percentage of a given" + " attribute's values. The attribute must be nominal." + " Missing value can be treated as as a distinct separate value."; } /** * Returns an enumeration describing the available options * * @return an enumeration of all the available options */ @Override public Enumeration




© 2015 - 2024 Weber Informatics LLC | Privacy Policy