I want interate a DataSetIterator and add it into a DataSet. Iterate is easy:
while (iterator.hasNext()) {
DataSet next = iterator.next();
dataSet.addRow(next, dataSet.numExamples()); // isn't work
}
if the DataSetIterator batch size is 1, when I do dataSet.addRow(next, 1);
this just replace this first element with the next one. If batch size is 2, then raise the exception: Exception in thread "main" java.lang.IllegalArgumentException: NDArrayIndex is out of range. Beginning index: 2 must be less than its size: 2
I also want know how add a DataSet into another DataSet.
DataSet
class has the static merge()
method. On this method, you pass a List<DataSet>
and returns all DataSet
contains into List
like one only DataSet
.
ArrayList<DataSet> data_list = new ArrayList<DataSet>();
// add some data into data_list
DataSet allData = DataSet.merge(data_list); // all DataSet into data_list are merged into allData