static protected int SFSSelectFeature(Set<Integer> available,DataSet dataSet,Set<Integer> catToRemove,Set<Integer> numToRemove,Set<Integer> catSelecteed,Set<Integer> numSelected,Object evaluater,int folds,Random rand,double[] PbestScore,int minFeatures){
  int nCat=dataSet.getNumCategoricalVars();
  int curBest=-1;
  double curBestScore=Double.POSITIVE_INFINITY;
  for (  int feature : available) {
    removeFeature(feature,nCat,catToRemove,numToRemove);
    DataSet workOn=dataSet.shallowClone();
    RemoveAttributeTransform remove=new RemoveAttributeTransform(workOn,catToRemove,numToRemove);
    workOn.applyTransform(remove);
    double score=getScore(workOn,evaluater,folds,rand);
    if (score < curBestScore) {
      curBestScore=score;
      curBest=feature;
    }
    addFeature(feature,nCat,catToRemove,numToRemove);
  }
  if (curBestScore <= 1e-14 && PbestScore[0] <= 1e-14 && catSelecteed.size() + numSelected.size() >= minFeatures)   return -1;
  if (curBestScore < PbestScore[0] || catSelecteed.size() + numSelected.size() < minFeatures || Math.abs(PbestScore[0] - curBestScore) < 1e-3) {
    PbestScore[0]=curBestScore;
    addFeature(curBest,nCat,catSelecteed,numSelected);
    removeFeature(curBest,nCat,catToRemove,numToRemove);
    available.remove(curBest);
    return curBest;
  }
 else   return -1;
}

static protected int SFSSelectFeature ( Set < Integer > available , DataSet dataSet , Set < Integer > catToRemove , Set < Integer > numToRemove , Set < Integer > catSelecteed , Set < Integer > numSelected , Object evaluater , int folds , Random rand , double [ ] PbestScore , int minFeatures ) { int nCat = dataSet . getNumCategoricalVars ( ) ; int curBest = - 1 ; double curBestScore = Double . POSITIVE_INFINITY ; for ( int feature : available ) { removeFeature ( feature , nCat , catToRemove , numToRemove ) ; DataSet workOn = dataSet . shallowClone ( ) ; RemoveAttributeTransform remove = new RemoveAttributeTransform ( workOn , catToRemove , numToRemove ) ; workOn . applyTransform ( remove ) ; double score = getScore ( workOn , evaluater , folds , rand ) ; if ( score < curBestScore ) { curBestScore = score ; curBest = feature ; } addFeature ( feature , nCat , catToRemove , numToRemove ) ; } if ( curBestScore <= 1e-14 && PbestScore [ 0 ] <= 1e-14 && catSelecteed . size ( ) + numSelected . size ( ) >= minFeatures ) return - 1 ; if ( curBestScore < PbestScore [ 0 ] || catSelecteed . size ( ) + numSelected . size ( ) < minFeatures || Math . abs ( PbestScore [ 0 ] - curBestScore ) < 1e-3 ) { PbestScore [ 0 ] = curBestScore ; addFeature ( curBest , nCat , catSelecteed , numSelected ) ; removeFeature ( curBest , nCat , catToRemove , numToRemove ) ; available . remove ( curBest ) ; return curBest ; } else return - 1 ; }
attempts to add one feature to the list of features while increasing or maintaining the current accuracy
