/** * Input an instance for filtering. Filter requires all training instances be * read before producing output. * * @param instance the input instance * @return true if the filtered instance may now be collected with output(). * @throws IllegalStateException if no input format has been set */ @Override public boolean input(Instance instance) { if (getInputFormat() == null) { throw new IllegalStateException("No input instance format defined"); } if (m_NewBatch) { resetQueue(); m_NewBatch = false; } convertInstance(instance); return true; }
/** * Input an instance for filtering. Filter requires all training instances be * read before producing output. * * @param instance the input instance * @return true if the filtered instance may now be collected with output(). * @throws IllegalStateException if no input format has been set */ @Override public boolean input(Instance instance) { if (getInputFormat() == null) { throw new IllegalStateException("No input instance format defined"); } if (m_NewBatch) { resetQueue(); m_NewBatch = false; } convertInstance(instance); return true; }
for (int i = 0; i < getInputFormat().numAttributes(); i++) { Attribute att = getInputFormat().attribute(i); if (att.isNominal() && i != getInputFormat().classIndex() && (att.numValues() > 2 || m_TransformAll || m_Numeric)) { m_needToTransform = true; setOutputFormat(getInputFormat()); return; newClassIndex = getInputFormat().classIndex(); newAtts = new ArrayList<Attribute>(); for (int j = 0; j < getInputFormat().numAttributes(); j++) { Attribute att = getInputFormat().attribute(j); if (!att.isNominal() || (j == getInputFormat().classIndex()) || !m_Columns.isInRange(j)) { newAtts.add((Attribute) att.copy()); if (newClassIndex >= 0 && j < getInputFormat().classIndex()) { newClassIndex += att.numValues() - 1; outputFormat = new Instances(getInputFormat().relationName(), newAtts, 0); outputFormat.setClassIndex(newClassIndex); setOutputFormat(outputFormat);
for (int i = 0; i < getInputFormat().numAttributes(); i++) { Attribute att = getInputFormat().attribute(i); if (att.isNominal() && i != getInputFormat().classIndex() && (att.numValues() > 2 || m_TransformAll || m_Numeric)) { m_needToTransform = true; setOutputFormat(getInputFormat()); return; newClassIndex = getInputFormat().classIndex(); newAtts = new ArrayList<Attribute>(); for (int j = 0; j < getInputFormat().numAttributes(); j++) { Attribute att = getInputFormat().attribute(j); if (!att.isNominal() || (j == getInputFormat().classIndex()) || !m_Columns.isInRange(j)) { newAtts.add((Attribute) att.copy()); if (newClassIndex >= 0 && j < getInputFormat().classIndex()) { newClassIndex += att.numValues() - 1; outputFormat = new Instances(getInputFormat().relationName(), newAtts, 0); outputFormat.setClassIndex(newClassIndex); setOutputFormat(outputFormat);
if (getInputFormat() != null) { setInputFormat(getInputFormat());
if (getInputFormat() != null) { setInputFormat(getInputFormat());
int attSoFar = 0; for (int j = 0; j < getInputFormat().numAttributes(); j++) { Attribute att = getInputFormat().attribute(j); if (!att.isNominal() || (j == getInputFormat().classIndex()) || !m_Columns.isInRange(j)) { vals[attSoFar] = instance.value(j);
int attSoFar = 0; for (int j = 0; j < getInputFormat().numAttributes(); j++) { Attribute att = getInputFormat().attribute(j); if (!att.isNominal() || (j == getInputFormat().classIndex()) || !m_Columns.isInRange(j)) { vals[attSoFar] = instance.value(j);