}
}
}
// create the test instance (original format)
Instance origTest = new DenseInstance(1.0, newVals);
origTest.setDataset(m_originalHeader);
// System.err.println("Original with periodic set " + origTest);
Instance transformedWithDate = origTest;
// do all the filters
// System.err.println("--- " + transformedWithDate);
// transformedWithDate = applyFilters(transformedWithDate, true, true);
transformedWithDate = m_lagMaker.processInstancePreview(
transformedWithDate, incrementTime, setPeriodics);
// the date time stamp (if exists) has now been remapped, so we can remove
// the original
m_dateRemover.input(transformedWithDate);
Instance transformed = m_dateRemover.output();
// System.err.println(transformedWithDate.dataset());
// System.err.println(transformedWithDate);
// System.err.println("Transformed: " + transformed);
// get a prediction
double[] preds = new double[m_singleTargetForecasters.size()];
for (int j = 0; j < m_singleTargetForecasters.size(); j++) {
preds[j] = m_singleTargetForecasters.get(j).forecastOneStepAhead(
transformed);
}
// predictions at step i for all the targets (can only handle a single
// target at
// present)
List<NumericPrediction> finalForecast = new ArrayList<NumericPrediction>();
// add confidence limits (if applicable)
for (int j = 0; j < m_fieldsToForecast.size(); j++) {
if (m_confidenceLimitEstimator != null
&& i < m_calculateConfLimitsSteps) {
double[] limits = m_confidenceLimitEstimator
.getConfidenceLimitsForTarget(m_fieldsToForecast.get(j),
preds[j], i + 1);
double[][] limitsToAdd = new double[1][];
limitsToAdd[0] = limits;
finalForecast.add(new NumericPrediction(Utils.missingValue(),
preds[j], 1.0, limitsToAdd));
} else {
finalForecast.add(new NumericPrediction(Utils.missingValue(),
preds[j]));
}
}
forecastForSteps.add(finalForecast);
// set the value of the target in the original test instance
for (int j = 0; j < m_fieldsToForecast.size(); j++) {
int targetIndex = m_originalHeader.attribute(m_fieldsToForecast.get(j))
.index();
origTest.setValue(targetIndex, preds[j]);
}
// If we have a real time stamp, then set the incremented value in the
// original
// test instance (doesn't really need to be done if we've read a
// non-missing
// time value out of any supplied overlay data)
if (!m_lagMaker.isUsingAnArtificialTimeIndex()
&& m_lagMaker.getAdjustForTrends()
&& m_lagMaker.getTimeStampField() != null
&& m_lagMaker.getTimeStampField().length() > 0) {
int timeIndex = m_originalHeader.attribute(
m_lagMaker.getTimeStampField()).index();
double timeValue = transformedWithDate.value(transformedWithDate
.dataset().attribute(m_lagMaker.getTimeStampField()));
origTest.setValue(timeIndex, timeValue);
}
// now re-prime the forecaster. Incremental method will never buffer here
// because we never have missing targets, since we've just forecasted
// them!