private void generateUniformIntegerExamples(Instances format,int numInstances,SubspaceClusterDefinition cl,String cName){
  Instance example=null;
  int numAtts=m_NumAttributes;
  if (getClassFlag()) {
    numAtts++;
  }
  example=new DenseInstance(numAtts);
  example.setDataset(format);
  boolean[] attributes=cl.getAttributes();
  double[] minValue=cl.getMinValue();
  double[] maxValue=cl.getMaxValue();
  int[] minInt=new int[minValue.length];
  int[] maxInt=new int[maxValue.length];
  int[] intValue=new int[maxValue.length];
  int[] numInt=new int[minValue.length];
  int num=1;
  for (int i=0; i < minValue.length; i++) {
    minInt[i]=(int)Math.ceil(minValue[i]);
    maxInt[i]=(int)Math.floor(maxValue[i]);
    numInt[i]=(maxInt[i] - minInt[i] + 1);
    num=num * numInt[i];
  }
  int numEach=numInstances / num;
  int rest=numInstances - numEach * num;
  for (int i=0; i < m_NumAttributes; i++) {
    if (attributes[i]) {
      example.setValue(i,minInt[i]);
      intValue[i]=minInt[i];
    }
 else {
      example.setMissing(i);
    }
  }
  if (getClassFlag()) {
    example.setClassValue(cName);
  }
  int added=0;
  int attr=0;
  do {
    for (int k=0; k < numEach; k++) {
      format.add(example);
      example=(Instance)example.copy();
      added++;
    }
    if (rest > 0) {
      format.add(example);
      example=(Instance)example.copy();
      added++;
      rest--;
    }
    if (added >= numInstances) {
      break;
    }
    boolean done=false;
    do {
      if (attributes[attr] && (intValue[attr] + 1 <= maxInt[attr])) {
        intValue[attr]++;
        done=true;
      }
 else {
        attr++;
      }
    }
 while (!done);
    example.setValue(attr,intValue[attr]);
  }
 while (added < numInstances);
}

private void generateUniformIntegerExamples ( Instances format , int numInstances , SubspaceClusterDefinition cl , String cName ) { Instance example = null ; int numAtts = m_NumAttributes ; if ( getClassFlag ( ) ) { numAtts ++ ; } example = new DenseInstance ( numAtts ) ; example . setDataset ( format ) ; boolean [ ] attributes = cl . getAttributes ( ) ; double [ ] minValue = cl . getMinValue ( ) ; double [ ] maxValue = cl . getMaxValue ( ) ; int [ ] minInt = new int [ minValue . length ] ; int [ ] maxInt = new int [ maxValue . length ] ; int [ ] intValue = new int [ maxValue . length ] ; int [ ] numInt = new int [ minValue . length ] ; int num = 1 ; for ( int i = 0 ; i < minValue . length ; i ++ ) { minInt [ i ] = ( int ) Math . ceil ( minValue [ i ] ) ; maxInt [ i ] = ( int ) Math . floor ( maxValue [ i ] ) ; numInt [ i ] = ( maxInt [ i ] - minInt [ i ] + 1 ) ; num = num * numInt [ i ] ; } int numEach = numInstances / num ; int rest = numInstances - numEach * num ; for ( int i = 0 ; i < m_NumAttributes ; i ++ ) { if ( attributes [ i ] ) { example . setValue ( i , minInt [ i ] ) ; intValue [ i ] = minInt [ i ] ; } else { example . setMissing ( i ) ; } } if ( getClassFlag ( ) ) { example . setClassValue ( cName ) ; } int added = 0 ; int attr = 0 ; do { for ( int k = 0 ; k < numEach ; k ++ ) { format . add ( example ) ; example = ( Instance ) example . copy ( ) ; added ++ ; } if ( rest > 0 ) { format . add ( example ) ; example = ( Instance ) example . copy ( ) ; added ++ ; rest -- ; } if ( added >= numInstances ) { break ; } boolean done = false ; do { if ( attributes [ attr ] && ( intValue [ attr ] + 1 <= maxInt [ attr ] ) ) { intValue [ attr ] ++ ; done = true ; } else { attr ++ ; } } while ( ! done ) ; example . setValue ( attr , intValue [ attr ] ) ; } while ( added < numInstances ) ; }
generate examples for a uniform cluster dataset .
