@Override public Instance generateExample() throws Exception {
  Instance result;
  Random rand;
  double x;
  double y;
  double[] atts;
  Instance inst;
  result=null;
  rand=getRandom();
  if (m_DatasetFormat == null) {
    throw new Exception("Dataset format not defined.");
  }
  x=rand.nextDouble();
  x=x * (getMaxRange() - getMinRange()) + getMinRange();
  atts=new double[1];
  atts[0]=x;
  inst=new DenseInstance(1.0,atts);
  m_Filter.input(inst);
  m_Filter.batchFinished();
  inst=m_Filter.output();
  y=inst.value(1) + getAmplitude() * m_NoiseRandom.nextGaussian() * getNoiseRate()* getNoiseVariance();
  atts=new double[m_DatasetFormat.numAttributes()];
  atts[0]=x;
  atts[1]=y;
  result=new DenseInstance(1.0,atts);
  result.setDataset(m_DatasetFormat);
  return result;
}

@ Override public Instance generateExample ( ) throws Exception { Instance result ; Random rand ; double x ; double y ; double [ ] atts ; Instance inst ; result = null ; rand = getRandom ( ) ; if ( m_DatasetFormat == null ) { throw new Exception ( "Dataset format not defined." ) ; } x = rand . nextDouble ( ) ; x = x * ( getMaxRange ( ) - getMinRange ( ) ) + getMinRange ( ) ; atts = new double [ 1 ] ; atts [ 0 ] = x ; inst = new DenseInstance ( 1.0 , atts ) ; m_Filter . input ( inst ) ; m_Filter . batchFinished ( ) ; inst = m_Filter . output ( ) ; y = inst . value ( 1 ) + getAmplitude ( ) * m_NoiseRandom . nextGaussian ( ) * getNoiseRate ( ) * getNoiseVariance ( ) ; atts = new double [ m_DatasetFormat . numAttributes ( ) ] ; atts [ 0 ] = x ; atts [ 1 ] = y ; result = new DenseInstance ( 1.0 , atts ) ; result . setDataset ( m_DatasetFormat ) ; return result ; }
generates one example of the dataset .
