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

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

package weka.filters.unsupervised.attribute;

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

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

/**
 *  An instance filter that adds an ID attribute to the
 * dataset. The new attribute contains a unique ID for each instance.
* Note: The ID is not reset for the second batch of instances when batch mode * is used from the command-line, or the FilteredClassifier. *

* * * Valid options are: *

* *

 * -C <index>
 *  Specify where to insert the ID. First and last
 *  are valid indexes.(default first)
 * 
* *
 * -N <name>
 *  Name of the new attribute.
 *  (default = 'ID')
 * 
* * * * @author fracpete (fracpete at waikato dot ac dot nz) * @version $Revision: 14508 $ */ public class AddID extends Filter implements UnsupervisedFilter, OptionHandler, WeightedInstancesHandler, WeightedAttributesHandler{ /** for serialization */ static final long serialVersionUID = 4734383199819293390L; /** the index of the attribute */ protected SingleIndex m_Index = new SingleIndex("first"); /** the name of the attribute */ protected String m_Name = "ID"; /** the counter for the ID */ protected int m_Counter = -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 adds an ID attribute to the dataset. " + "The new attribute contains a unique ID for each instance.\n\n" + "Note: The ID is not reset for the second batch of instances " + "when batch mode is used from the command-line, or the FilteredClassifier."; } /** * Returns an enumeration describing the available options. * * @return an enumeration of all the available options. */ @Override public Enumeration

Ads help maintain this website.