/*
 *   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 .
 */

/*
 *    ReplaceWithMissingValue.java
 *    Copyright (C) 2015 University of Waikato, Hamilton, New Zealand
 *
 */

package weka.filters.unsupervised.attribute;

import weka.core.*;
import weka.filters.SimpleBatchFilter;
import weka.filters.UnsupervisedFilter;

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

/**
 * 
 * A filter that can be used to introduce missing values in a dataset.
 * The specified probability is used to flip a biased coin to decide whether to replace a particular
 * attribute value in an instance with a missing value (i.e., a probability of 0.9 means 90% of values
 * will be replaced with missing values). This filter only modifies the first batch of data that is processed.
 * The class attribute is skipped by default.
 * 

* * * * Valid options are:

* *

 -R <col1,col2-col4,...>
 *  Specifies list of columns to modify. First and last are valid indexes.
 *  (default: first-last)
* *
 -V
 *  Invert matching sense of column indexes.
* *
 -S <num>
 *  Specify the random number seed (default 1)
* *
 -P <double>
 *  Specify the probability  (default 0.1)
* *
 -unset-class-temporarily
 *  Unsets the class index temporarily before the filter is
 *  applied to the data.
 *  (default: no)
* * * * @author Eibe Frank (eibe@cs.waikato.ac.nz) * @version $Revision: 10215 $ */ public class ReplaceWithMissingValue extends SimpleBatchFilter implements UnsupervisedFilter, Randomizable, WeightedAttributesHandler, WeightedInstancesHandler { /** for serialization */ private static final long serialVersionUID = -2356630932899796239L; /** Stores which columns to turn into nominals */ protected Range m_Cols = new Range("first-last"); /** The default columns to turn into nominals */ protected String m_DefaultCols = "first-last"; /** The seed for the random number generator */ protected int m_Seed = 1; /** The probability */ protected double m_Probability = 0.1; /** True if the class is to be unset */ protected boolean m_IgnoreClass = false; /** * Gets an enumeration describing the available options. * * @return an enumeration of all the available options. */ @Override public Enumeration

Ads help maintain this website.