78
78
* When selecting on nominal attributes, removes header
79
79
* references to excluded values.</pre>
82
* Do not apply the filter to instances that arrive after the first
83
* (training) batch. The default is to apply the filter (i.e.
84
* the filter may not return an instance if it matches the remove criteria)</pre>
81
86
<!-- options-end -->
83
88
* @author Eibe Frank (eibe@cs.waikato.ac.nz)
84
* @version $Revision: 5548 $
89
* @version $Revision: 7602 $
86
91
public class RemoveWithValues
108
113
/** If m_ModifyHeader, stores a mapping from old to new indexes */
109
114
protected int [] m_NominalMapping;
116
/** Whether to filter instances after the first batch has been processed */
117
protected boolean m_dontFilterAfterFirstBatch = false;
112
120
* Returns a string describing this classifier
159
167
"\tWhen selecting on nominal attributes, removes header\n"
160
168
+ "\treferences to excluded values.",
170
newVector.addElement(new Option(
171
"\tDo not apply the filter to instances that arrive after the first\n" +
172
"\t(training) batch. The default is to apply the filter (i.e.\n" +
173
"\tthe filter may not return an instance if it matches the remove criteria)",
163
176
return newVector.elements();
196
209
* When selecting on nominal attributes, removes header
197
210
* references to excluded values.</pre>
213
* Do not apply the filter to instances that arrive after the first
214
* (training) batch. The default is to apply the filter (i.e.
215
* the filter may not return an instance if it matches the remove criteria)</pre>
199
217
<!-- options-end -->
201
219
* @param options the list of options as an array of strings
226
244
setInvertSelection(Utils.getFlag('V', options));
227
245
setMatchMissingValues(Utils.getFlag('M', options));
228
246
setModifyHeader(Utils.getFlag('H', options));
247
setDontFilterAfterFirstBatch(Utils.getFlag('F', options));
229
248
// Re-initialize output format according to new options
231
250
if (getInputFormat() != null) {
356
378
m_NewBatch = false;
381
if (isFirstBatchDone() && m_dontFilterAfterFirstBatch) {
382
push((Instance)instance.copy());
358
386
if (instance.isMissing(m_AttIndex.getIndex())) {
359
387
if (!getMatchMissingValues()) {
360
388
push((Instance)instance.copy());
601
629
m_Values.setRanges(rangeList);
633
* Set whether to apply the filter to instances that arrive once
634
* the first (training) batch has been seen. The default is to
635
* not apply the filter and just return each instance input. This
636
* is so that, when used in the FilteredClassifier, a test instance
637
* does not get "consumed" by the filter and a prediction is always
640
* @param b true if the filter should *not* be applied to instances that
641
* arrive after the first (training) batch has been processed.
643
public void setDontFilterAfterFirstBatch(boolean b) {
644
m_dontFilterAfterFirstBatch = b;
648
* Get whether to apply the filter to instances that arrive once
649
* the first (training) batch has been seen. The default is to
650
* not apply the filter and just return each instance input. This
651
* is so that, when used in the FilteredClassifier, a test instance
652
* does not get "consumed" by the filter and a prediction is always
655
* @return true if the filter should *not* be applied to instances that
656
* arrive after the first (training) batch has been processed.
658
public boolean getDontFilterAfterFirstBatch() {
659
return m_dontFilterAfterFirstBatch;
663
* Returns the tip text for this property.
665
* @return tip text for this property suitable for
666
* displaying in the explorer/experimenter gui
668
public String dontFilterAfterFirstBatchTipText() {
669
return "Whether to apply the filtering process to instances that " +
670
"are input after the first (training) batch. The default " +
671
"is false so instances in subsequent batches can potentially " +
672
"get 'consumed' by the filter.";
605
676
* Set which values of a nominal attribute are to be used for