/** * Initializes the format for the dataset produced. Must be called before the * generateExample or generateExamples methods are used. Re-initializes the * random number generator with the given seed. * * @return the format for the dataset * @throws Exception if the generating of the format failed * @see #getSeed() */ @Override public Instances defineDataFormat() throws Exception { ArrayList<Attribute> atts; // initialize input format atts = new ArrayList<Attribute>(); atts.add(new Attribute("x")); m_RawData = new Instances(getRelationNameToUse(), atts, 0); m_Filter = new AddExpression(); m_Filter.setName("y"); m_Filter.setExpression(getExpression()); m_Filter.setInputFormat(m_RawData); return super.defineDataFormat(); }
/** * Initializes the format for the dataset produced. Must be called before the * generateExample or generateExamples methods are used. Re-initializes the * random number generator with the given seed. * * @return the format for the dataset * @throws Exception if the generating of the format failed * @see #getSeed() */ @Override public Instances defineDataFormat() throws Exception { ArrayList<Attribute> atts; // initialize input format atts = new ArrayList<Attribute>(); atts.add(new Attribute("x")); m_RawData = new Instances(getRelationNameToUse(), atts, 0); m_Filter = new AddExpression(); m_Filter.setName("y"); m_Filter.setExpression(getExpression()); m_Filter.setInputFormat(m_RawData); return super.defineDataFormat(); }
public void testAddNamed() { m_Filter = getFilter("a3+a6"); String name = "BongoBongo"; ((AddExpression)m_Filter).setName(name); Instances result = useFilter(); assertEquals(name, result.attribute(result.numAttributes() - 1).name()); name = "BongoBongoSecond"; ((AddExpression)m_Filter).setName(name); result = useFilter(); assertEquals(name, result.attribute(result.numAttributes() - 1).name()); }
public void testAddNamed() { m_Filter = getFilter("a3+a6"); String name = "BongoBongo"; ((AddExpression)m_Filter).setName(name); Instances result = useFilter(); assertEquals(name, result.attribute(result.numAttributes() - 1).name()); name = "BongoBongoSecond"; ((AddExpression)m_Filter).setName(name); result = useFilter(); assertEquals(name, result.attribute(result.numAttributes() - 1).name()); }