private int sequentialForwardSelection(String dataFile,String[] features,int indVarColNumber,int X[],int Y[],double J[],int rowIni,int rowEnd){
  double sig[]=new double[Y.length];
  int sigIndex[]=new int[Y.length];
  double corXplusy[]=new double[Y.length];
  double corX;
  if (X.length > 0) {
    Regression reg=new Regression();
    reg.multipleLinearRegression(dataFile,indVarColNumber,X,features,interceptTerm,rowIni,rowEnd);
    corX=reg.getCorrelation();
  }
 else   corX=0.0;
  for (int i=0; i < Y.length; i++) {
    corXplusy[i]=correlationOfNewFeature(dataFile,features,indVarColNumber,X,Y[i],rowIni,rowEnd);
    sig[i]=corXplusy[i] - corX;
    sigIndex[i]=Y[i];
  }
  int minSig=MathUtils.getMinIndex(sig);
  J[0]=corXplusy[minSig];
  J[1]=corX;
  int maxSig=MathUtils.getMaxIndex(sig);
  J[2]=corXplusy[maxSig];
  return sigIndex[maxSig];
}

private int sequentialForwardSelection ( String dataFile , String [ ] features , int indVarColNumber , int X [ ] , int Y [ ] , double J [ ] , int rowIni , int rowEnd ) { double sig [ ] = new double [ Y . length ] ; int sigIndex [ ] = new int [ Y . length ] ; double corXplusy [ ] = new double [ Y . length ] ; double corX ; if ( X . length > 0 ) { Regression reg = new Regression ( ) ; reg . multipleLinearRegression ( dataFile , indVarColNumber , X , features , interceptTerm , rowIni , rowEnd ) ; corX = reg . getCorrelation ( ) ; } else corX = 0.0 ; for ( int i = 0 ; i < Y . length ; i ++ ) { corXplusy [ i ] = correlationOfNewFeature ( dataFile , features , indVarColNumber , X , Y [ i ] , rowIni , rowEnd ) ; sig [ i ] = corXplusy [ i ] - corX ; sigIndex [ i ] = Y [ i ] ; } int minSig = MathUtils . getMinIndex ( sig ) ; J [ 0 ] = corXplusy [ minSig ] ; J [ 1 ] = corX ; int maxSig = MathUtils . getMaxIndex ( sig ) ; J [ 2 ] = corXplusy [ maxSig ] ; return sigIndex [ maxSig ] ; }
find the f feature in y that maximise j ( x + y )
