I have a training data which has one instance with class label "yes" and I want to remove this instance. ok, I removed this instance but I could not know how to save the new training data because I want to use it out of the for loop. I use the following code
Dataset[] folds = data.folds((10), new Random(100));
Dataset training = new DefaultDataset(); //training, testing
Dataset testing = new DefaultDataset();
int[] tr = {0, 2, 3, 5, 7, 8, 9};
int[] te = {1, 4, 6};
for (int i = 0; i < 7; i++) {
training.addAll(folds[tr[i]]);
}
for (int i = 0; i < 3; i++) {
testing.addAll(folds[te[i]]);
}
int numFolds = 10;
Dataset[] foldsTrain = training.folds(numFolds, new Random(1));
for (int i=0; i<56; ++i)
{
if (!training.instance(i).classValue().equals("yes"))
{
System.out.println("the new training data"+ training.instance(i))
}
}
Thank All