public double minDataDLIfDeleted(int index,double expFPRate,boolean checkErr){
  double[] rulesetStat=new double[6];
  int more=m_Ruleset.size() - 1 - index;
  ArrayList<double[]> indexPlus=new ArrayList<double[]>(more);
  for (int j=0; j < index; j++) {
    rulesetStat[0]+=m_SimpleStats.get(j)[0];
    rulesetStat[2]+=m_SimpleStats.get(j)[2];
    rulesetStat[4]+=m_SimpleStats.get(j)[4];
  }
  Instances data=(index == 0) ? m_Data : m_Filtered.get(index - 1)[1];
  for (int j=(index + 1); j < m_Ruleset.size(); j++) {
    double[] stats=new double[6];
    Instances[] split=computeSimpleStats(j,data,stats,null);
    indexPlus.add(stats);
    rulesetStat[0]+=stats[0];
    rulesetStat[2]+=stats[2];
    rulesetStat[4]+=stats[4];
    data=split[1];
  }
  if (more > 0) {
    rulesetStat[1]=indexPlus.get(indexPlus.size() - 1)[1];
    rulesetStat[3]=indexPlus.get(indexPlus.size() - 1)[3];
    rulesetStat[5]=indexPlus.get(indexPlus.size() - 1)[5];
  }
 else   if (index > 0) {
    rulesetStat[1]=m_SimpleStats.get(index - 1)[1];
    rulesetStat[3]=m_SimpleStats.get(index - 1)[3];
    rulesetStat[5]=m_SimpleStats.get(index - 1)[5];
  }
 else {
    rulesetStat[1]=m_SimpleStats.get(0)[0] + m_SimpleStats.get(0)[1];
    rulesetStat[3]=m_SimpleStats.get(0)[3] + m_SimpleStats.get(0)[4];
    rulesetStat[5]=m_SimpleStats.get(0)[2] + m_SimpleStats.get(0)[5];
  }
  double potential=0;
  for (int k=index + 1; k < m_Ruleset.size(); k++) {
    double[] ruleStat=indexPlus.get(k - index - 1);
    double ifDeleted=potential(k,expFPRate,rulesetStat,ruleStat,checkErr);
    if (!Double.isNaN(ifDeleted)) {
      potential+=ifDeleted;
    }
  }
  double dataDLWithout=dataDL(expFPRate,rulesetStat[0],rulesetStat[1],rulesetStat[4],rulesetStat[5]);
  return (dataDLWithout - potential);
}

public double minDataDLIfDeleted ( int index , double expFPRate , boolean checkErr ) { double [ ] rulesetStat = new double [ 6 ] ; int more = m_Ruleset . size ( ) - 1 - index ; ArrayList < double [ ] > indexPlus = new ArrayList < double [ ] > ( more ) ; for ( int j = 0 ; j < index ; j ++ ) { rulesetStat [ 0 ] += m_SimpleStats . get ( j ) [ 0 ] ; rulesetStat [ 2 ] += m_SimpleStats . get ( j ) [ 2 ] ; rulesetStat [ 4 ] += m_SimpleStats . get ( j ) [ 4 ] ; } Instances data = ( index == 0 ) ? m_Data : m_Filtered . get ( index - 1 ) [ 1 ] ; for ( int j = ( index + 1 ) ; j < m_Ruleset . size ( ) ; j ++ ) { double [ ] stats = new double [ 6 ] ; Instances [ ] split = computeSimpleStats ( j , data , stats , null ) ; indexPlus . add ( stats ) ; rulesetStat [ 0 ] += stats [ 0 ] ; rulesetStat [ 2 ] += stats [ 2 ] ; rulesetStat [ 4 ] += stats [ 4 ] ; data = split [ 1 ] ; } if ( more > 0 ) { rulesetStat [ 1 ] = indexPlus . get ( indexPlus . size ( ) - 1 ) [ 1 ] ; rulesetStat [ 3 ] = indexPlus . get ( indexPlus . size ( ) - 1 ) [ 3 ] ; rulesetStat [ 5 ] = indexPlus . get ( indexPlus . size ( ) - 1 ) [ 5 ] ; } else if ( index > 0 ) { rulesetStat [ 1 ] = m_SimpleStats . get ( index - 1 ) [ 1 ] ; rulesetStat [ 3 ] = m_SimpleStats . get ( index - 1 ) [ 3 ] ; rulesetStat [ 5 ] = m_SimpleStats . get ( index - 1 ) [ 5 ] ; } else { rulesetStat [ 1 ] = m_SimpleStats . get ( 0 ) [ 0 ] + m_SimpleStats . get ( 0 ) [ 1 ] ; rulesetStat [ 3 ] = m_SimpleStats . get ( 0 ) [ 3 ] + m_SimpleStats . get ( 0 ) [ 4 ] ; rulesetStat [ 5 ] = m_SimpleStats . get ( 0 ) [ 2 ] + m_SimpleStats . get ( 0 ) [ 5 ] ; } double potential = 0 ; for ( int k = index + 1 ; k < m_Ruleset . size ( ) ; k ++ ) { double [ ] ruleStat = indexPlus . get ( k - index - 1 ) ; double ifDeleted = potential ( k , expFPRate , rulesetStat , ruleStat , checkErr ) ; if ( ! Double . isNaN ( ifDeleted ) ) { potential += ifDeleted ; } } double dataDLWithout = dataDL ( expFPRate , rulesetStat [ 0 ] , rulesetStat [ 1 ] , rulesetStat [ 4 ] , rulesetStat [ 5 ] ) ; return ( dataDLWithout - potential ) ; }
compute the minimal data description length of the ruleset if the rule in the given position is deleted . < br > the min_data_dl_if_deleted = data_dl_if_deleted - potential
