/** Generate the cutpoints for each attribute */ protected void calculateCutPoints() { m_CutPoints = new double[getInputFormat().numAttributes()][]; for (int i = getInputFormat().numAttributes() - 1; i >= 0; i--) { if ((m_DiscretizeCols.isInRange(i)) && (getInputFormat().attribute(i).isNumeric()) && (getInputFormat().classIndex() != i)) { if (m_FindNumBins) { findNumBins(i); } else if (!m_UseEqualFrequency) { calculateCutPointsByEqualWidthBinning(i); } else { calculateCutPointsByEqualFrequencyBinning(i); } } } }
/** Generate the cutpoints for each attribute */ protected void calculateCutPoints() { m_CutPoints = new double[getInputFormat().numAttributes()][]; for (int i = getInputFormat().numAttributes() - 1; i >= 0; i--) { if ((m_DiscretizeCols.isInRange(i)) && (getInputFormat().attribute(i).isNumeric()) && (getInputFormat().classIndex() != i)) { if (m_FindNumBins) { findNumBins(i); } else if (!m_UseEqualFrequency) { calculateCutPointsByEqualWidthBinning(i); } else { calculateCutPointsByEqualFrequencyBinning(i); } } } }
/** * Signifies that this batch of input to the filter is finished. If the filter * requires all instances prior to filtering, output() may now be called to * retrieve the filtered instances. * * @return true if there are instances pending output * @throws IllegalStateException if no input structure has been defined */ @Override public boolean batchFinished() { if (getInputFormat() == null) { throw new IllegalStateException("No input instance format defined"); } if (m_CutPoints == null) { calculateCutPoints(); setOutputFormat(); // If we implement saving cutfiles, save the cuts here // Convert pending input instances for (int i = 0; i < getInputFormat().numInstances(); i++) { convertInstance(getInputFormat().instance(i)); } } flushInput(); m_NewBatch = true; return (numPendingOutput() != 0); }
/** * Signifies that this batch of input to the filter is finished. If the filter * requires all instances prior to filtering, output() may now be called to * retrieve the filtered instances. * * @return true if there are instances pending output * @throws IllegalStateException if no input structure has been defined */ @Override public boolean batchFinished() { if (getInputFormat() == null) { throw new IllegalStateException("No input instance format defined"); } if (m_CutPoints == null) { calculateCutPoints(); setOutputFormat(); // If we implement saving cutfiles, save the cuts here // Convert pending input instances for (int i = 0; i < getInputFormat().numInstances(); i++) { convertInstance(getInputFormat().instance(i)); } } flushInput(); m_NewBatch = true; return (numPendingOutput() != 0); }
for (int i = 0; i < getInputFormat().numInstances(); i++) { currentInstance = getInputFormat().instance(i); if (!currentInstance.isMissing(index)) { currentVal = currentInstance.value(index);
for (int i = 0; i < getInputFormat().numInstances(); i++) { currentInstance = getInputFormat().instance(i); if (!currentInstance.isMissing(index)) { currentVal = currentInstance.value(index);
/** * Input an instance for filtering. Ordinarily the instance is processed and * made available for output immediately. Some filters require all 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 defined. */ @Override public boolean input(Instance instance) { if (getInputFormat() == null) { throw new IllegalStateException("No input instance format defined"); } if (m_NewBatch) { resetQueue(); m_NewBatch = false; } if (m_CutPoints != null) { convertInstance(instance); return true; } bufferInput(instance); return false; }
/** * Input an instance for filtering. Ordinarily the instance is processed and * made available for output immediately. Some filters require all 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 defined. */ @Override public boolean input(Instance instance) { if (getInputFormat() == null) { throw new IllegalStateException("No input instance format defined"); } if (m_NewBatch) { resetQueue(); m_NewBatch = false; } if (m_CutPoints != null) { convertInstance(instance); return true; } bufferInput(instance); return false; }
for (int i = 0; i < getInputFormat().numInstances(); i++) { currentInstance = getInputFormat().instance(i); if (!currentInstance.isMissing(index)) { currentVal = currentInstance.value(index); for (int j = 0; j < getInputFormat().numInstances(); j++) { currentInstance = getInputFormat().instance(j); if (!currentInstance.isMissing(index)) { for (int k = 0; k < i + 1; k++) {
for (int i = 0; i < getInputFormat().numInstances(); i++) { currentInstance = getInputFormat().instance(i); if (!currentInstance.isMissing(index)) { currentVal = currentInstance.value(index); for (int j = 0; j < getInputFormat().numInstances(); j++) { currentInstance = getInputFormat().instance(j); if (!currentInstance.isMissing(index)) { for (int k = 0; k < i + 1; k++) {
ArrayList<Attribute> attributes = new ArrayList<Attribute>(getInputFormat() .numAttributes()); int classIndex = getInputFormat().classIndex(); for (int i = 0, m = getInputFormat().numAttributes(); i < m; ++i) { if ((m_DiscretizeCols.isInRange(i)) && (getInputFormat().attribute(i).isNumeric()) && (getInputFormat().classIndex() != i)) { Attribute newAtt = new Attribute(getInputFormat().attribute(i).name(), attribValues); newAtt.setWeight(getInputFormat().attribute(i).weight()); attributes.add(newAtt); } else { ArrayList<String> attribValues = new ArrayList<String>(1); attribValues.add("'All'"); Attribute newAtt = new Attribute(getInputFormat().attribute(i).name(), attribValues); newAtt.setWeight(getInputFormat().attribute(i).weight()); attributes.add(newAtt); } else { if (i < getInputFormat().classIndex()) { classIndex += cutPoints.length - 1; Attribute newAtt = new Attribute(getInputFormat().attribute(i) .name() + "_" + (j + 1), attribValues); if (getSpreadAttributeWeight()) { newAtt.setWeight(getInputFormat().attribute(i).weight() / cutPoints.length); } else { newAtt.setWeight(getInputFormat().attribute(i).weight());
ArrayList<Attribute> attributes = new ArrayList<Attribute>(getInputFormat() .numAttributes()); int classIndex = getInputFormat().classIndex(); for (int i = 0, m = getInputFormat().numAttributes(); i < m; ++i) { if ((m_DiscretizeCols.isInRange(i)) && (getInputFormat().attribute(i).isNumeric()) && (getInputFormat().classIndex() != i)) { Attribute newAtt = new Attribute(getInputFormat().attribute(i).name(), attribValues); newAtt.setWeight(getInputFormat().attribute(i).weight()); attributes.add(newAtt); } else { ArrayList<String> attribValues = new ArrayList<String>(1); attribValues.add("'All'"); Attribute newAtt = new Attribute(getInputFormat().attribute(i).name(), attribValues); newAtt.setWeight(getInputFormat().attribute(i).weight()); attributes.add(newAtt); } else { if (i < getInputFormat().classIndex()) { classIndex += cutPoints.length - 1; Attribute newAtt = new Attribute(getInputFormat().attribute(i) .name() + "_" + (j + 1), attribValues); if (getSpreadAttributeWeight()) { newAtt.setWeight(getInputFormat().attribute(i).weight() / cutPoints.length); } else { newAtt.setWeight(getInputFormat().attribute(i).weight());
if (getInputFormat() != null) { setInputFormat(getInputFormat());
if (getInputFormat() != null) { setInputFormat(getInputFormat());
double[] vals = new double[outputFormatPeek().numAttributes()]; for (int i = 0; i < getInputFormat().numAttributes(); i++) { if (m_DiscretizeCols.isInRange(i) && getInputFormat().attribute(i).isNumeric() && (getInputFormat().classIndex() != i)) { int j; double currentVal = instance.value(i);
double[] vals = new double[outputFormatPeek().numAttributes()]; for (int i = 0; i < getInputFormat().numAttributes(); i++) { if (m_DiscretizeCols.isInRange(i) && getInputFormat().attribute(i).isNumeric() && (getInputFormat().classIndex() != i)) { int j; double currentVal = instance.value(i);
Instances data = new Instances(getInputFormat());
Instances data = new Instances(getInputFormat());