/** * creates a RemoveUseless filter with the given percentage of allowed * variance */ protected Filter getFilter(double percentage) { RemoveUseless f = new RemoveUseless(); f.setMaximumVariancePercentageAllowed(percentage); return f; }
setMaximumVariancePercentageAllowed((int) Double.valueOf(mString) .doubleValue()); } else { setMaximumVariancePercentageAllowed(99.0); if (getInputFormat() != null) { setInputFormat(getInputFormat());
/** Creates a default RemoveUseless */ public Filter getFilter() { return getFilter(new RemoveUseless().getMaximumVariancePercentageAllowed()); }
/** * Main method for testing this class. * * @param argv should contain arguments to the filter: use -h for help */ public static void main(String[] argv) { runFilter(new RemoveUseless(), argv); } }
/** * Input an instance for filtering. * * @param instance the input instance * @return true if the filtered instance may now be collected with output(). */ @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_removeFilter != null) { m_removeFilter.input(instance); Instance processed = m_removeFilter.output(); copyValues(processed, false, instance.dataset(), outputFormatPeek()); push(processed, false); // No need to copy return true; } bufferInput(instance); return false; }
Normalize norm = new Normalize(); norm.setInputFormat(train); train = Filter.useFilter(train, norm); RemoveUseless ru = new RemoveUseless(); ru.setInputFormat(train); train = Filter.useFilter(train, ru); Ranker rank = new Ranker(); InfoGainAttributeEval eval = new InfoGainAttributeEval(); eval.buildEvaluator(train);
m_RemoveUseless.input(instance); instance =m_RemoveUseless.output(); m_RemoveUseless.batchFinished();
/** * Gets the current settings of the filter. * * @return an array of strings suitable for passing to setOptions */ @Override public String[] getOptions() { Vector<String> options = new Vector<String>(); options.add("-M"); options.add("" + getMaximumVariancePercentageAllowed()); return options.toArray(new String[0]); }
m_AttFilter = new RemoveUseless(); m_AttFilter.setInputFormat(train); train = Filter.useFilter(train, m_AttFilter);
/** * Input an instance for filtering. * * @param instance the input instance * @return true if the filtered instance may now be collected with output(). */ @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_removeFilter != null) { m_removeFilter.input(instance); Instance processed = m_removeFilter.output(); copyValues(processed, false, instance.dataset(), outputFormatPeek()); push(processed, false); // No need to copy return true; } bufferInput(instance); return false; }
/** * Main method for testing this class. * * @param argv should contain arguments to the filter: use -h for help */ public static void main(String[] argv) { runFilter(new RemoveUseless(), argv); } }
/** * Gets the current settings of the filter. * * @return an array of strings suitable for passing to setOptions */ @Override public String[] getOptions() { Vector<String> options = new Vector<String>(); options.add("-M"); options.add("" + getMaximumVariancePercentageAllowed()); return options.toArray(new String[0]); }
m_AttFilter = new RemoveUseless(); m_AttFilter.setInputFormat(train); train = Filter.useFilter(train, m_AttFilter);
/** * Output class "probabilities". These need to be calibrated. */ public double[] distributionForInstance(Instance inst) throws Exception { // Filter instance m_RemoveUseless.input(inst); inst = m_RemoveUseless.output(); // Convert instance to matrix Vector instM = new DenseVector(inst.numAttributes() - 1); int index = 0; for (int i = 0; i < inst.numAttributes(); i++) { if (i != m_Data.classIndex()) { instM.set(index++, inst.value(i)); } } // Pipe output through sigmoid double[] dist = new double[2]; dist[1] = 1/(1 + Math.exp(instM.dot(m_Weights) - m_Threshold)); dist[0] = 1 - dist[1]; return dist; }
/** * creates a RemoveUseless filter with the given percentage of allowed * variance */ protected Filter getFilter(double percentage) { RemoveUseless f = new RemoveUseless(); f.setMaximumVariancePercentageAllowed(percentage); return f; }
/** Creates a default RemoveUseless */ public Filter getFilter() { return getFilter(new RemoveUseless().getMaximumVariancePercentageAllowed()); }
setMaximumVariancePercentageAllowed((int) Double.valueOf(mString) .doubleValue()); } else { setMaximumVariancePercentageAllowed(99.0); if (getInputFormat() != null) { setInputFormat(getInputFormat());
m_RemoveUseless = new RemoveUseless(); m_RemoveUseless.setInputFormat(m_data); m_data = Filter.useFilter(data, m_RemoveUseless);