public RegressionDataSet asRegressionDataSet(int index)
    {
        if(index < 0)
            throw new IllegalArgumentException("Index must be a non-negative value");
        else if(getNumNumericalVars()== 0)
            throw new IllegalArgumentException("Dataset has no numeric variables, can not create regression dataset");
        else if(index >= getNumNumericalVars())
            throw new IllegalArgumentException("Index " + index + " i larger than number of numeric features " + getNumNumericalVars());
        
        RegressionDataSet rds = new RegressionDataSet(this.datapoints.toList(), index);
	for(int i = 0; i < size(); i++)
	    rds.setWeight(i, this.getWeight(i));
	return rds;
    }
public RegressionDataSet asRegressionDataSet ( int index ) { if ( index < 0 ) throw new IllegalArgumentException ( "Index must be a non-negative value" ) ; else if ( getNumNumericalVars ( ) == 0 ) throw new IllegalArgumentException ( "Dataset has no numeric variables, can not create regression dataset" ) ; else if ( index >= getNumNumericalVars ( ) ) throw new IllegalArgumentException ( "Index " + index + " i larger than number of numeric features " + getNumNumericalVars ( ) ) ; RegressionDataSet rds = new RegressionDataSet ( this . datapoints . toList ( ) , index ) ; for ( int i = 0 ; i < size ( ) ; i ++ ) rds . setWeight ( i , this . getWeight ( i ) ) ; return rds ; }
Converts this dataset into one meant for regression problems. The
given numeric feature index is removed from the data and made the
target variable for the regression problem.

@param index the regression variable index, should be in the range
[0, {@link #getNumNumericalVars() })
@return a new dataset where one numeric variable is removed and made
the target of a regression dataset