@Override protected Instances process(Instances instances) throws Exception {
  Instances result;
  Instance instOld;
  Instance instNew;
  int i;
  int n;
  double[] values;
  int numAttNew;
  int numAttOld;
  if (!isFirstBatchDone()) {
    computeThresholds(instances);
  }
  result=getOutputFormat();
  numAttOld=instances.numAttributes();
  numAttNew=result.numAttributes();
  for (n=0; n < instances.numInstances(); n++) {
    instOld=instances.instance(n);
    values=new double[numAttNew];
    System.arraycopy(instOld.toDoubleArray(),0,values,0,numAttOld);
    instNew=new DenseInstance(1.0,values);
    instNew.setDataset(result);
    if (!getDetectionPerAttribute()) {
      if (isOutlier(instOld)) {
        instNew.setValue(m_OutlierAttributePosition[0],1);
      }
      if (isExtremeValue(instOld)) {
        instNew.setValue(m_OutlierAttributePosition[0] + 1,1);
        if (getExtremeValuesAsOutliers()) {
          instNew.setValue(m_OutlierAttributePosition[0],1);
        }
      }
    }
 else {
      for (i=0; i < m_AttributeIndices.length; i++) {
        if (m_AttributeIndices[i] == NON_NUMERIC) {
          continue;
        }
        if (isOutlier(instOld,m_AttributeIndices[i])) {
          instNew.setValue(m_OutlierAttributePosition[i],1);
        }
        if (isExtremeValue(instOld,m_AttributeIndices[i])) {
          instNew.setValue(m_OutlierAttributePosition[i] + 1,1);
          if (getExtremeValuesAsOutliers()) {
            instNew.setValue(m_OutlierAttributePosition[i],1);
          }
        }
        if (getOutputOffsetMultiplier()) {
          instNew.setValue(m_OutlierAttributePosition[i] + 2,calculateMultiplier(instOld,m_AttributeIndices[i]));
        }
      }
    }
    copyValues(instNew,false,instOld.dataset(),getOutputFormat());
    result.add(instNew);
  }
  return result;
}

@ Override protected Instances process ( Instances instances ) throws Exception { Instances result ; Instance instOld ; Instance instNew ; int i ; int n ; double [ ] values ; int numAttNew ; int numAttOld ; if ( ! isFirstBatchDone ( ) ) { computeThresholds ( instances ) ; } result = getOutputFormat ( ) ; numAttOld = instances . numAttributes ( ) ; numAttNew = result . numAttributes ( ) ; for ( n = 0 ; n < instances . numInstances ( ) ; n ++ ) { instOld = instances . instance ( n ) ; values = new double [ numAttNew ] ; System . arraycopy ( instOld . toDoubleArray ( ) , 0 , values , 0 , numAttOld ) ; instNew = new DenseInstance ( 1.0 , values ) ; instNew . setDataset ( result ) ; if ( ! getDetectionPerAttribute ( ) ) { if ( isOutlier ( instOld ) ) { instNew . setValue ( m_OutlierAttributePosition [ 0 ] , 1 ) ; } if ( isExtremeValue ( instOld ) ) { instNew . setValue ( m_OutlierAttributePosition [ 0 ] + 1 , 1 ) ; if ( getExtremeValuesAsOutliers ( ) ) { instNew . setValue ( m_OutlierAttributePosition [ 0 ] , 1 ) ; } } } else { for ( i = 0 ; i < m_AttributeIndices . length ; i ++ ) { if ( m_AttributeIndices [ i ] == NON_NUMERIC ) { continue ; } if ( isOutlier ( instOld , m_AttributeIndices [ i ] ) ) { instNew . setValue ( m_OutlierAttributePosition [ i ] , 1 ) ; } if ( isExtremeValue ( instOld , m_AttributeIndices [ i ] ) ) { instNew . setValue ( m_OutlierAttributePosition [ i ] + 1 , 1 ) ; if ( getExtremeValuesAsOutliers ( ) ) { instNew . setValue ( m_OutlierAttributePosition [ i ] , 1 ) ; } } if ( getOutputOffsetMultiplier ( ) ) { instNew . setValue ( m_OutlierAttributePosition [ i ] + 2 , calculateMultiplier ( instOld , m_AttributeIndices [ i ] ) ) ; } } } copyValues ( instNew , false , instOld . dataset ( ) , getOutputFormat ( ) ) ; result . add ( instNew ) ; } return result ; }
processes the given data ( may change the provided dataset ) and returns the modified version . this method is called in batchfinished ( ) . this implementation only calls process ( instance ) for each instance in the given dataset .
