code: public ClassificationDataSet asClassificationDataSet(int index)
      {
          if(index < 0)
              throw new IllegalArgumentException("Index must be a non-negative value");
          else if(getNumCategoricalVars() == 0)
              throw new IllegalArgumentException("Dataset has no categorical variables, can not create classification dataset");
          else if(index >= getNumCategoricalVars())
              throw new IllegalArgumentException("Index " + index + " is larger than number of categorical features " + getNumCategoricalVars());
          return new ClassificationDataSet(this, index);
      }
docs: Converts this dataset into one meant for classification problems. The
  given categorical feature index is removed from the data and made the
  target variable for the classification problem.
  
  @param index the classification variable index, should be in the range
  [0, {@link #getNumCategoricalVars() })
  @return a new dataset where one categorical variable is removed and made
  the target of a classification dataset