[Home] DMelt member access. Java source code: weka.filters.unsupervised.attribute.ClassAssigner
/*
* 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 .
*/
/*
* ClassAssigner.java
* Copyright (C) 2006-2012 University of Waikato, Hamilton, New Zealand
*/
package weka.filters.unsupervised.attribute;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Vector;
import weka.core.*;
import weka.core.Capabilities.Capability;
import weka.filters.SimpleStreamFilter;
/**
* Filter that can set and unset the class index.
*
*
*
* Valid options are:
*
*
*
* -D
* Turns on output of debugging information.
*
*
*
* -C <num|first|last|0>
* The index of the class attribute. Index starts with 1, 'first'
* and 'last' are accepted, '0' unsets the class index.
* (default: last)
*
*
*
*
* @author fracpete (fracpete at waikato dot ac dot nz)
* @version $Revision: 14508 $
*/
public class ClassAssigner extends SimpleStreamFilter implements WeightedInstancesHandler, WeightedAttributesHandler {
/** for serialization. */
private static final long serialVersionUID = 1775780193887394115L;
/** use the first attribute as class. */
public final static int FIRST = 0;
/** use the last attribute as class. */
public final static int LAST = -2;
/** unset the class attribute. */
public final static int UNSET = -1;
/** the class index. */
protected int m_ClassIndex = LAST;
/**
* Returns a string describing this classifier.
*
* @return a description of the classifier suitable for displaying in the
* explorer/experimenter gui
*/
@Override
public String globalInfo() {
return "Filter that can set and unset the class index.";
}
/**
* Returns an enumeration describing the available options.
*
* @return an enumeration of all the available options.
*/
@Override
public Enumeration