@Override public Instance generateExample() throws Exception {
  Instance result;
  double[] atts;
  int i;
  int selected;
  Random random;
  result=null;
  random=getRandom();
  if (m_DatasetFormat == null) {
    throw new Exception("Dataset format not defined.");
  }
  atts=new double[m_DatasetFormat.numAttributes()];
  selected=random.nextInt(10);
  for (i=0; i < 7; i++) {
    if ((1 + (random.nextInt(100))) <= getNoisePercent()) {
      atts[i]=m_originalInstances[selected][i] == 0 ? 1 : 0;
    }
 else {
      atts[i]=m_originalInstances[selected][i];
    }
  }
  for (i=0; i < m_numIrrelevantAttributes; i++) {
    atts[i + 7]=random.nextInt(2);
  }
  atts[atts.length - 1]=selected;
  result=new DenseInstance(1.0,atts);
  result.setDataset(m_DatasetFormat);
  return result;
}

@ Override public Instance generateExample ( ) throws Exception { Instance result ; double [ ] atts ; int i ; int selected ; Random random ; result = null ; random = getRandom ( ) ; if ( m_DatasetFormat == null ) { throw new Exception ( "Dataset format not defined." ) ; } atts = new double [ m_DatasetFormat . numAttributes ( ) ] ; selected = random . nextInt ( 10 ) ; for ( i = 0 ; i < 7 ; i ++ ) { if ( ( 1 + ( random . nextInt ( 100 ) ) ) <= getNoisePercent ( ) ) { atts [ i ] = m_originalInstances [ selected ] [ i ] == 0 ? 1 : 0 ; } else { atts [ i ] = m_originalInstances [ selected ] [ i ] ; } } for ( i = 0 ; i < m_numIrrelevantAttributes ; i ++ ) { atts [ i + 7 ] = random . nextInt ( 2 ) ; } atts [ atts . length - 1 ] = selected ; result = new DenseInstance ( 1.0 , atts ) ; result . setDataset ( m_DatasetFormat ) ; return result ; }
generates one example of the dataset .
