PointDouble values;
Instances data;
Evaluation eval;
PointDouble result;
Classifier classifier;
Filter filter;
int size;
boolean cached;
boolean allCached;
Performance p1;
Performance p2;
double x;
double y;
performances = new Vector();
log("Determining best pair with " + cv + "-fold CV in Grid:\n" + grid + "\n");
if (m_Traversal == TRAVERSAL_BY_COLUMN)
size = grid.width();
else
size = grid.height();
allCached = true;
for (i = 0; i < size; i++) {
if (m_Traversal == TRAVERSAL_BY_COLUMN)
enm = grid.column(i);
else
enm = grid.row(i);
filter = null;
data = null;
while (enm.hasMoreElements()) {
values = enm.nextElement();
// already calculated?
cached = m_Cache.isCached(cv, values);
if (cached) {
performances.add(m_Cache.get(cv, values));
}
else {
allCached = false;
x = evaluate(values.getX(), true);
y = evaluate(values.getY(), false);
// data pass through filter
if (filter == null) {
filter = (Filter) setup(getFilter(), x, y);
filter.setInputFormat(inst);
data = Filter.useFilter(inst, filter);
// make sure that the numbers don't get too small - otherwise NaNs!
Filter cleaner = new NumericCleaner();
cleaner.setInputFormat(data);
data = Filter.useFilter(data, cleaner);
}
// setup classifier
classifier = (Classifier) setup(getClassifier(), x, y);