private double instanceTransformationProbability(Instance first,Instance second){
  double transProb=1.0;
  int numMissAttr=0;
  for (int i=0; i < m_NumAttributes; i++) {
    if (i == m_Train.classIndex()) {
      continue;
    }
    if (first.isMissing(i)) {
      numMissAttr++;
      continue;
    }
    transProb*=attrTransProb(first,second,i);
    if (numMissAttr != m_NumAttributes) {
      transProb=Math.pow(transProb,(double)m_NumAttributes / (m_NumAttributes - numMissAttr));
    }
 else {
      transProb=0.0;
    }
  }
  return transProb / m_NumInstances;
}

private double instanceTransformationProbability ( Instance first , Instance second ) { double transProb = 1.0 ; int numMissAttr = 0 ; for ( int i = 0 ; i < m_NumAttributes ; i ++ ) { if ( i == m_Train . classIndex ( ) ) { continue ; } if ( first . isMissing ( i ) ) { numMissAttr ++ ; continue ; } transProb *= attrTransProb ( first , second , i ) ; if ( numMissAttr != m_NumAttributes ) { transProb = Math . pow ( transProb , ( double ) m_NumAttributes / ( m_NumAttributes - numMissAttr ) ) ; } else { transProb = 0.0 ; } } return transProb / m_NumInstances ; }
calculate the probability of the first instance transforming into the second instance : the probability is the product of the transformation probabilities of the attributes normilized over the number of instances used .
